home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / commctrl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  131.4 KB  |  4,194 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * commctrl.h - - Interface for the Windows Common Controls                    *
  4. *                                                                             *
  5. * Version 1.2                                                                 *
  6. *                                                                             *
  7. * Copyright (c) 1991-1998, Microsoft Corp.      All rights reserved.          *
  8. *                                                                             *
  9. \*****************************************************************************/
  10.  
  11.  
  12. #ifndef _INC_COMMCTRL
  13. #define _INC_COMMCTRL
  14.  
  15. #ifndef _WIN32_IE
  16. #define _WIN32_IE 0x0400
  17. #else
  18. #if (_WIN32_IE < 0x0400) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
  19. #error _WIN32_IE setting conflicts with _WIN32_WINNT setting
  20. #endif
  21. #endif
  22.  
  23. #ifndef _HRESULT_DEFINED
  24. #define _HRESULT_DEFINED
  25. typedef LONG HRESULT;
  26. #endif // _HRESULT_DEFINED
  27.  
  28. #ifndef NOUSER
  29.  
  30.  
  31. //
  32. // Define API decoration for direct importing of DLL references.
  33. //
  34. #ifndef WINCOMMCTRLAPI
  35. #if !defined(_COMCTL32_) && defined(_WIN32)
  36. #ifdef _WIN32_WCE_EMULATION
  37. #define WINCOMMCTRLAPI
  38. #else
  39. #define WINCOMMCTRLAPI DECLSPEC_IMPORT
  40. #endif
  41. #else
  42. #define WINCOMMCTRLAPI
  43. #endif
  44. #endif // WINCOMMCTRLAPI
  45.  
  46. //
  47. // For compilers that don't support nameless unions
  48. //
  49. #ifndef DUMMYUNIONNAME
  50. #ifdef NONAMELESSUNION
  51. #define DUMMYUNIONNAME          u
  52. #define DUMMYUNIONNAME2         u2
  53. #define DUMMYUNIONNAME3         u3
  54. #else
  55. #define DUMMYUNIONNAME
  56. #define DUMMYUNIONNAME2
  57. #define DUMMYUNIONNAME3
  58. #endif
  59. #endif // DUMMYUNIONNAME
  60.  
  61. #ifndef UNDER_CE
  62. #ifdef _WIN32
  63. #include <pshpack1.h>
  64. #endif
  65. #endif // !UNDER_CE
  66.  
  67. #ifdef __cplusplus
  68. extern "C" {
  69. #endif
  70.  
  71. //
  72. // Users of this header may define any number of these constants to avoid
  73. // the definitions of each functional group.
  74. //
  75. //    NOTOOLBAR    Customizable bitmap-button toolbar control.
  76. //    NOUPDOWN     Up and Down arrow increment/decrement control.
  77. //    NOSTATUSBAR  Status bar control.
  78. //    NOMENUHELP   APIs to help manage menus, especially with a status bar.
  79. //    NOTRACKBAR   Customizable column-width tracking control.
  80. //    NODRAGLIST   APIs to make a listbox source and sink drag&drop actions.
  81. //    NOPROGRESS   Progress gas gauge.
  82. //    NOHOTKEY     HotKey control
  83. //    NOHEADER     Header bar control.
  84. //    NOIMAGEAPIS  ImageList apis.
  85. //    NOLISTVIEW   ListView control.
  86. //    NOTREEVIEW   TreeView control.
  87. //    NOTABCONTROL Tab control.
  88. //    NOANIMATE    Animate control.
  89. //
  90. //=============================================================================
  91.  
  92. #include <prsht.h>
  93.  
  94. #ifndef UNDER_CE
  95. #ifndef SNDMSG
  96. #ifdef __cplusplus
  97. #define SNDMSG ::SendMessage
  98. #else
  99. #define SNDMSG SendMessage
  100. #endif
  101. #endif // ifndef SNDMSG
  102. #else // UNDER_CE
  103. #ifndef SNDMSG
  104. #define SNDMSG SendMessage
  105. #endif
  106. #endif // !UNDER_CE
  107.  
  108. #ifdef UNDER_CE // Moved from pcommctr.h.
  109. #define LVIS_ALL                0xFFFF
  110. #endif //UNDER_CE
  111.  
  112. WINCOMMCTRLAPI void WINAPI InitCommonControls(void);
  113.  
  114. #if (_WIN32_IE >= 0x0300)
  115. typedef struct tagINITCOMMONCONTROLSEX {
  116.     DWORD dwSize;             // size of this structure
  117.     DWORD dwICC;              // flags indicating which classes to be initialized
  118. } INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX;
  119. #define ICC_LISTVIEW_CLASSES 0x00000001 // listview, header
  120. #define ICC_TREEVIEW_CLASSES 0x00000002 // treeview, tooltips
  121. #define ICC_BAR_CLASSES      0x00000004 // toolbar, statusbar, trackbar, tooltips
  122. #define ICC_TAB_CLASSES      0x00000008 // tab, tooltips
  123. #define ICC_UPDOWN_CLASS     0x00000010 // updown
  124. #define ICC_PROGRESS_CLASS   0x00000020 // progress
  125. #define ICC_WIN95_CLASSES    0x000000FF
  126. #define ICC_DATE_CLASSES     0x00000100 // month picker, date picker, time picker, updown
  127. #define ICC_COOL_CLASSES     0x00000400 // rebar (coolbar) control
  128. #define ICC_TOOLTIP_CLASSES  0x00001000 // Tooltip static & button
  129. #define ICC_CAPEDIT_CLASS    0x00002000 // All-caps edit control
  130. WINCOMMCTRLAPI BOOL WINAPI InitCommonControlsEx(LPINITCOMMONCONTROLSEX);
  131. #endif      // _WIN32_IE >= 0x0300
  132.  
  133. #define ODT_HEADER              100
  134. #define ODT_TAB                 101
  135. #define ODT_LISTVIEW            102
  136.  
  137.  
  138. //====== Ranges for control message IDs =======================================
  139.  
  140. #define LVM_FIRST               0x1000      // ListView messages
  141. #define TV_FIRST                0x1100      // TreeView messages
  142. #define HDM_FIRST               0x1200      // Header messages
  143.  
  144. //====== WM_NOTIFY Macros =====================================================
  145.  
  146. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
  147.     (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  148. #define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) \
  149.     (LRESULT)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(idFrom), (LPARAM)(NMHDR FAR*)(pnmhdr))
  150.  
  151.  
  152. //====== Generic WM_NOTIFY notification codes =================================
  153.  
  154. #define NM_OUTOFMEMORY          (NM_FIRST-1)
  155. #define NM_CLICK                (NM_FIRST-2)
  156. #define NM_DBLCLK               (NM_FIRST-3)
  157. #define NM_RETURN               (NM_FIRST-4)
  158. #define NM_RCLICK               (NM_FIRST-5)
  159. #define NM_RDBLCLK              (NM_FIRST-6)
  160. #define NM_SETFOCUS             (NM_FIRST-7)
  161. #define NM_KILLFOCUS            (NM_FIRST-8)
  162. #if (_WIN32_IE >= 0x0300)
  163. #define NM_CUSTOMDRAW           (NM_FIRST-12)
  164. #define NM_HOVER                (NM_FIRST-13)
  165. #endif
  166. #if (_WIN32_IE >= 0x0400)
  167. #define NM_NCHITTEST            (NM_FIRST-14)
  168. #define NM_KEYDOWN              (NM_FIRST-15)
  169. #endif
  170.  
  171. #if (_WIN32_IE >= 0x0400)
  172. //====== Generic WM_NOTIFY notification structures ============================
  173.  
  174. typedef struct tagNMMOUSE {
  175.     NMHDR   hdr;
  176.     DWORD   dwItemSpec;
  177.     DWORD   dwItemData;
  178.     POINT   pt;
  179. } NMMOUSE, FAR* LPNMMOUSE;
  180.  
  181. typedef NMMOUSE NMCLICK;
  182. typedef LPNMMOUSE LPNMCLICK;
  183.  
  184. // Generic structure for a key
  185.  
  186. typedef struct tagNMKEY
  187. {
  188.     NMHDR hdr;
  189.     WORD wVKey;
  190.     UINT flags;
  191. } NMKEY, FAR *LPNMKEY;
  192.  
  193. #endif           // _WIN32_IE >= 0x0400
  194.  
  195. //====== WM_NOTIFY codes (NMHDR.code values) ==================================
  196.  
  197. #define NM_FIRST                (0U-  0U)       // generic to all controls
  198. #define NM_LAST                 (0U- 99U)
  199.  
  200. #define LVN_FIRST               (0U-100U)       // listview
  201. #define LVN_LAST                (0U-199U)
  202.  
  203. #define HDN_FIRST               (0U-300U)       // header
  204. #define HDN_LAST                (0U-399U)
  205.  
  206. #define TVN_FIRST               (0U-400U)       // treeview
  207. #define TVN_LAST                (0U-499U)
  208.  
  209. #define TTN_FIRST               (0U-520U)       // tooltips
  210. #define TTN_LAST                (0U-549U)
  211.  
  212. #define TCN_FIRST               (0U-550U)       // tab control
  213. #define TCN_LAST                (0U-580U)
  214.  
  215. // Shell reserved               (0U-580U) -  (0U-589U)
  216.  
  217. #define CDN_FIRST               (0U-601U)       // common dialog (new)
  218. #define CDN_LAST                (0U-699U)
  219.  
  220. #define TBN_FIRST               (0U-700U)       // toolbar
  221. #define TBN_LAST                (0U-720U)
  222.  
  223. #define UDN_FIRST               (0U-721)        // updown
  224. #define UDN_LAST                (0U-740)
  225. #if (_WIN32_IE >= 0x0300)
  226. #define MCN_FIRST               (0U-750U)       // monthcal
  227. #define MCN_LAST                (0U-759U)
  228.  
  229. #define DTN_FIRST               (0U-760U)       // datetimepick
  230. #define DTN_LAST                (0U-799U)
  231.  
  232. #define RBN_FIRST               (0U-831U)       // rebar
  233. #define RBN_LAST                (0U-859U)
  234. #endif
  235.  
  236. #if (_WIN32_IE >= 0x0400)
  237. #define SBN_FIRST               (0U-880U)        // status bar
  238. #define SBN_LAST                (0U-900U)       
  239. #endif
  240.  
  241. #define MSGF_COMMCTRL_BEGINDRAG     0x4200
  242. #define MSGF_COMMCTRL_SIZEHEADER    0x4201
  243. #define MSGF_COMMCTRL_DRAGSELECT    0x4202
  244.  
  245. #if (_WIN32_IE >= 0x0300)
  246. //==================== CUSTOM DRAW ==========================================
  247.  
  248.  
  249. // custom draw return flags
  250. // values under 0x00010000 are reserved for global custom draw values.
  251. // above that are for specific controls
  252. #define CDRF_DODEFAULT          0x00000000
  253. #define CDRF_NEWFONT            0x00000002
  254. #define CDRF_SKIPDEFAULT        0x00000004
  255.  
  256.  
  257. #define CDRF_NOTIFYPOSTPAINT    0x00000010
  258. #define CDRF_NOTIFYITEMDRAW     0x00000020
  259. #if (_WIN32_IE >= 0x0400)
  260. #define CDRF_NOTIFYSUBITEMDRAW  0x00000020  // flags are the same, we can distinguish by context
  261. #endif
  262. #define CDRF_NOTIFYPOSTERASE    0x00000040
  263.  
  264.  
  265.  
  266. // drawstage flags
  267. // values under 0x00010000 are reserved for global custom draw values.
  268. // above that are for specific controls
  269. #define CDDS_PREPAINT           0x00000001
  270. #define CDDS_POSTPAINT          0x00000002
  271. #define CDDS_PREERASE           0x00000003
  272. #define CDDS_POSTERASE          0x00000004
  273. // the 0x000010000 bit means it's individual item specific
  274. #define CDDS_ITEM               0x00010000
  275. #define CDDS_ITEMPREPAINT       (CDDS_ITEM | CDDS_PREPAINT)
  276. #define CDDS_ITEMPOSTPAINT      (CDDS_ITEM | CDDS_POSTPAINT)
  277. #define CDDS_ITEMPREERASE       (CDDS_ITEM | CDDS_PREERASE)
  278. #define CDDS_ITEMPOSTERASE      (CDDS_ITEM | CDDS_POSTERASE)
  279. #if (_WIN32_IE >= 0x0400)
  280. #define CDDS_SUBITEM            0x00020000
  281. #endif
  282.  
  283.  
  284. // itemState flags
  285. #define CDIS_SELECTED    0x0001
  286. #define CDIS_GRAYED      0x0002
  287. #define CDIS_DISABLED    0x0004
  288. #define CDIS_CHECKED     0x0008
  289. #define CDIS_FOCUS       0x0010
  290. #define CDIS_DEFAULT     0x0020
  291. #define CDIS_HOT         0x0040
  292.  
  293. typedef struct tagNMCUSTOMDRAWINFO
  294. {
  295.     NMHDR hdr;
  296.     DWORD dwDrawStage;
  297.     HDC hdc;
  298.     RECT rc;
  299.     DWORD dwItemSpec;  // this is control specific, but it's how to specify an item.  valid only with CDDS_ITEM bit set
  300.     UINT  uItemState;
  301.     LPARAM lItemlParam;
  302. } NMCUSTOMDRAW, FAR * LPNMCUSTOMDRAW;
  303.  
  304.  
  305.  
  306. // for tooltips
  307.  
  308. typedef struct tagNMTTCUSTOMDRAW
  309. {
  310.     NMCUSTOMDRAW nmcd;
  311.     UINT uDrawFlags;
  312. } NMTTCUSTOMDRAW, FAR * LPNMTTCUSTOMDRAW;
  313.  
  314. #endif      // _WIN32_IE >= 0x0300
  315.  
  316.  
  317. //====== IMAGE APIS ===========================================================
  318.  
  319. #ifndef NOIMAGEAPIS
  320.  
  321. #define CLR_NONE                0xFFFFFFFFL
  322. #define CLR_DEFAULT             0xFF000000L
  323.  
  324. struct _IMAGELIST;
  325. typedef struct _IMAGELIST NEAR* HIMAGELIST;
  326.  
  327. #if (_WIN32_IE >= 0x0300)
  328. typedef struct _IMAGELISTDRAWPARAMS {
  329.     DWORD       cbSize;
  330.     HIMAGELIST  himl;
  331.     int         i;
  332.     HDC         hdcDst;
  333.     int         x;
  334.     int         y;
  335.     int         cx;
  336.     int         cy;
  337.     int         xBitmap;        // x offest from the upperleft of bitmap
  338.     int         yBitmap;        // y offset from the upperleft of bitmap
  339.     COLORREF    rgbBk;
  340.     COLORREF    rgbFg;
  341.     UINT        fStyle;
  342.     DWORD       dwRop;
  343. } IMAGELISTDRAWPARAMS, FAR * LPIMAGELISTDRAWPARAMS;
  344. #endif      // _WIN32_IE >= 0x0300
  345.  
  346. #define ILC_MASK                0x0001
  347. #define ILC_COLOR               0x0000
  348. #define ILC_COLORDDB            0x00FE
  349. #define ILC_PALETTE             0x0800      // (no longer supported...never worked anyway)
  350.  
  351.  
  352. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Create(int cx, int cy, UINT flags, int cInitial, int cGrow);
  353. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Destroy(HIMAGELIST himl);
  354. WINCOMMCTRLAPI int         WINAPI ImageList_GetImageCount(HIMAGELIST himl);
  355. #if (_WIN32_IE >= 0x0300)
  356. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetImageCount(HIMAGELIST himl, UINT uNewCount);
  357. #endif
  358. WINCOMMCTRLAPI int         WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
  359. WINCOMMCTRLAPI int         WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, int i, HICON hicon);
  360. WINCOMMCTRLAPI COLORREF    WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk);
  361. WINCOMMCTRLAPI COLORREF    WINAPI ImageList_GetBkColor(HIMAGELIST himl);
  362. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetOverlayImage(HIMAGELIST himl, int iImage, int iOverlay);
  363.  
  364. #define     ImageList_AddIcon(himl, hicon) ImageList_ReplaceIcon(himl, -1, hicon)
  365.  
  366. #define ILD_NORMAL              0x0000
  367. #define ILD_TRANSPARENT         0x0001
  368. #define ILD_MASK                0x0010
  369. #define ILD_IMAGE               0x0020
  370. #if (_WIN32_IE >= 0x0300)
  371. #define ILD_ROP                 0x0040
  372. #endif
  373. #define ILD_BLEND25             0x0002
  374. #define ILD_BLEND50             0x0004
  375. #define ILD_OVERLAYMASK         0x0F00
  376. #define INDEXTOOVERLAYMASK(i)   ((i) << 8)
  377.  
  378. #define ILD_SELECTED            ILD_BLEND50
  379. #define ILD_FOCUS               ILD_BLEND25
  380. #define ILD_BLEND               ILD_BLEND50
  381. #define CLR_HILIGHT             CLR_DEFAULT
  382.  
  383. WINCOMMCTRLAPI BOOL WINAPI ImageList_Draw(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, UINT fStyle);
  384.  
  385.  
  386. #ifdef _WIN32
  387.  
  388. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Replace(HIMAGELIST himl, int i, HBITMAP hbmImage, HBITMAP hbmMask);
  389. WINCOMMCTRLAPI int         WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hbmImage, COLORREF crMask);
  390. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DrawEx(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle);
  391. #if (_WIN32_IE >= 0x0300)
  392. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DrawIndirect(IMAGELISTDRAWPARAMS* pimldp);
  393. #endif
  394. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Remove(HIMAGELIST himl, int i);
  395. WINCOMMCTRLAPI HICON       WINAPI ImageList_GetIcon(HIMAGELIST himl, int i, UINT flags);
  396.  
  397. #ifndef UNDER_CE // The W&A versions of this function did not exist in previous versions.
  398.                  // WinCE only supports the Unicode version.
  399. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_LoadImageA(HINSTANCE hi, LPCSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
  400. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_LoadImageW(HINSTANCE hi, LPCWSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
  401.  
  402. #ifdef UNICODE
  403. #define ImageList_LoadImage     ImageList_LoadImageW
  404. #else
  405. #define ImageList_LoadImage     ImageList_LoadImageA
  406. #endif
  407.  
  408. #else  // UNDER_CE
  409. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_LoadImage(HINSTANCE hi, LPCTSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
  410. #endif // !UNDER_CE
  411.  
  412. #if (_WIN32_IE >= 0x0300)
  413. #define ILCF_MOVE   (0x00000000)
  414. #define ILCF_SWAP   (0x00000001)
  415. WINCOMMCTRLAPI BOOL        WINAPI ImageList_Copy(HIMAGELIST himlDst, int iDst, HIMAGELIST himlSrc, int iSrc, UINT uFlags);
  416. #endif
  417.  
  418. WINCOMMCTRLAPI BOOL        WINAPI ImageList_BeginDrag(HIMAGELIST himlTrack, int iTrack, int dxHotspot, int dyHotspot);
  419. WINCOMMCTRLAPI void        WINAPI ImageList_EndDrag();
  420. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragEnter(HWND hwndLock, int x, int y);
  421. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragLeave(HWND hwndLock);
  422. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragMove(int x, int y);
  423. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetDragCursorImage(HIMAGELIST himlDrag, int iDrag, int dxHotspot, int dyHotspot);
  424.  
  425. WINCOMMCTRLAPI BOOL        WINAPI ImageList_DragShowNolock(BOOL fShow);
  426. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_GetDragImage(POINT FAR* ppt,POINT FAR* pptHotspot);
  427.  
  428. #define     ImageList_RemoveAll(himl) ImageList_Remove(himl, -1)
  429. #define     ImageList_ExtractIcon(hi, himl, i) ImageList_GetIcon(himl, i, 0)
  430. #define     ImageList_LoadBitmap(hi, lpbmp, cx, cGrow, crMask) ImageList_LoadImage(hi, lpbmp, cx, cGrow, crMask, IMAGE_BITMAP, 0)
  431.  
  432. typedef struct _IMAGEINFO
  433. {
  434.     HBITMAP hbmImage;
  435.     HBITMAP hbmMask;
  436.     int     Unused1;
  437.     int     Unused2;
  438.     RECT    rcImage;
  439. } IMAGEINFO, FAR *LPIMAGEINFO;
  440.  
  441. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetIconSize(HIMAGELIST himl, int FAR *cx, int FAR *cy);
  442. WINCOMMCTRLAPI BOOL        WINAPI ImageList_SetIconSize(HIMAGELIST himl, int cx, int cy);
  443. WINCOMMCTRLAPI BOOL        WINAPI ImageList_GetImageInfo(HIMAGELIST himl, int i, IMAGEINFO FAR* pImageInfo);
  444. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Merge(HIMAGELIST himl1, int i1, HIMAGELIST himl2, int i2, int dx, int dy);
  445. #if (_WIN32_IE >= 0x0400)
  446. WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Duplicate(HIMAGELIST himl);
  447. #endif
  448.  
  449. #ifdef UNDER_CE // Retaining for backward compatibility because this was in 1.0
  450. #ifdef _WIN32_WCE_EMULATION
  451. HBITMAP WINAPI CreateColorBitmap(int cx, int cy);
  452. HBITMAP WINAPI CreateMonoBitmap(int cx, int cy);
  453. #else
  454. HBITMAP CreateColorBitmap(int cx, int cy);
  455. HBITMAP CreateMonoBitmap(int cx, int cy);
  456. #endif
  457. void WINAPI ImageList_CopyDitherImage (HIMAGELIST himlDest, WORD iDst, int xDst, int yDst, HIMAGELIST himlSrc,
  458.         int iSrc, UINT fStyle);
  459. #endif // UNDER_CE
  460.  
  461. #endif
  462.  
  463. #endif
  464.  
  465.  
  466. //====== HEADER CONTROL =======================================================
  467.  
  468. #ifndef NOHEADER
  469.  
  470. #ifdef _WIN32
  471. #define WC_HEADERA              "SysHeader32"
  472. #define WC_HEADERW              L"SysHeader32"
  473.  
  474. #ifdef UNICODE
  475. #define WC_HEADER               WC_HEADERW
  476. #else
  477. #define WC_HEADER               WC_HEADERA
  478. #endif
  479.  
  480. #else
  481. #define WC_HEADER               "SysHeader"
  482. #endif
  483.  
  484. // begin_r_commctrl                     
  485.  
  486. #define HDS_HORZ                0x0000
  487. #define HDS_BUTTONS             0x0002
  488. #define HDS_HIDDEN              0x0008
  489.  
  490.  
  491. #if (_WIN32_IE >= 0x0300)
  492. #define HDS_DRAGDROP            0x0040
  493. #define HDS_FULLDRAG            0x0080
  494. #endif
  495.  
  496. // end_r_commctrl
  497.  
  498. #if (_WIN32_IE >= 0x0300)
  499. #define HD_ITEMA HDITEMA
  500. #define HD_ITEMW HDITEMW
  501. #else
  502. #define HDITEMW  HD_ITEMW
  503. #define HDITEMA  HD_ITEMA
  504. #endif
  505. #define HD_ITEM HDITEM
  506.  
  507. typedef struct _HD_ITEMA
  508. {
  509.     UINT    mask;
  510.     int     cxy;
  511.     LPSTR   pszText;
  512.     HBITMAP hbm;
  513.     int     cchTextMax;
  514.     int     fmt;
  515.     LPARAM  lParam;
  516. #if (_WIN32_IE >= 0x0300)
  517.     int     iImage;        // index of bitmap in ImageList
  518.     int     iOrder;        // where to draw this item
  519. #endif
  520. } HDITEMA, FAR * LPHDITEMA;
  521.  
  522.  
  523. typedef struct _HD_ITEMW
  524. {
  525.     UINT    mask;
  526.     int     cxy;
  527.     LPWSTR   pszText;
  528.     HBITMAP hbm;
  529.     int     cchTextMax;
  530.     int     fmt;
  531.     LPARAM  lParam;
  532. #if (_WIN32_IE >= 0x0300)
  533.     int     iImage;        // index of bitmap in ImageList
  534.     int     iOrder;
  535. #endif
  536. } HDITEMW, FAR * LPHDITEMW;
  537.  
  538. #ifdef UNICODE
  539. #define HDITEM HDITEMW
  540. #define LPHDITEM LPHDITEMW
  541. #else
  542. #define HDITEM HDITEMA
  543. #define LPHDITEM LPHDITEMW
  544. #endif
  545.  
  546.  
  547. #define HDI_WIDTH               0x0001
  548. #define HDI_HEIGHT              HDI_WIDTH
  549. #define HDI_TEXT                0x0002
  550. #define HDI_FORMAT              0x0004
  551. #define HDI_LPARAM              0x0008
  552. #define HDI_BITMAP              0x0010
  553. #if (_WIN32_IE >= 0x0300)
  554. #define HDI_IMAGE               0x0020
  555. #define HDI_DI_SETITEM          0x0040
  556. #define HDI_ORDER               0x0080
  557. #endif
  558.  
  559. #define HDF_LEFT                0
  560. #define HDF_RIGHT               1
  561. #define HDF_CENTER              2
  562. #define HDF_JUSTIFYMASK         0x0003
  563. #define HDF_RTLREADING          4
  564.  
  565. #define HDF_OWNERDRAW           0x8000
  566. #define HDF_STRING              0x4000
  567. #define HDF_BITMAP              0x2000
  568. #if (_WIN32_IE >= 0x0300)
  569. #define HDF_BITMAP_ON_RIGHT     0x1000
  570. #define HDF_IMAGE               0x0800
  571. #endif
  572.  
  573. #define HDM_GETITEMCOUNT        (HDM_FIRST + 0)
  574. #define Header_GetItemCount(hwndHD) \
  575.     (int)SNDMSG((hwndHD), HDM_GETITEMCOUNT, 0, 0L)
  576.  
  577.  
  578. #define HDM_INSERTITEMA         (HDM_FIRST + 1)
  579. #define HDM_INSERTITEMW         (HDM_FIRST + 10)
  580.  
  581. #ifdef UNICODE
  582. #define HDM_INSERTITEM          HDM_INSERTITEMW
  583. #else
  584. #define HDM_INSERTITEM          HDM_INSERTITEMA
  585. #endif
  586.  
  587. #define Header_InsertItem(hwndHD, i, phdi) \
  588.     (int)SNDMSG((hwndHD), HDM_INSERTITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  589.  
  590.  
  591. #define HDM_DELETEITEM          (HDM_FIRST + 2)
  592. #define Header_DeleteItem(hwndHD, i) \
  593.     (BOOL)SNDMSG((hwndHD), HDM_DELETEITEM, (WPARAM)(int)(i), 0L)
  594.  
  595.  
  596. #define HDM_GETITEMA            (HDM_FIRST + 3)
  597. #define HDM_GETITEMW            (HDM_FIRST + 11)
  598.  
  599. #ifdef UNICODE
  600. #define HDM_GETITEM             HDM_GETITEMW
  601. #else
  602. #define HDM_GETITEM             HDM_GETITEMA
  603. #endif
  604.  
  605. #define Header_GetItem(hwndHD, i, phdi) \
  606.     (BOOL)SNDMSG((hwndHD), HDM_GETITEM, (WPARAM)(int)(i), (LPARAM)(HD_ITEM FAR*)(phdi))
  607.  
  608.  
  609. #define HDM_SETITEMA            (HDM_FIRST + 4)
  610. #define HDM_SETITEMW            (HDM_FIRST + 12)
  611.  
  612. #ifdef UNICODE
  613. #define HDM_SETITEM             HDM_SETITEMW
  614. #else
  615. #define HDM_SETITEM             HDM_SETITEMA
  616. #endif
  617.  
  618. #define Header_SetItem(hwndHD, i, phdi) \
  619.     (BOOL)SNDMSG((hwndHD), HDM_SETITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  620.  
  621. #if (_WIN32_IE >= 0x0300)
  622. #define HD_LAYOUT  HDLAYOUT
  623. #else
  624. #define HDLAYOUT   HD_LAYOUT
  625. #endif
  626.  
  627. typedef struct _HD_LAYOUT
  628. {
  629.     RECT FAR* prc;
  630.     WINDOWPOS FAR* pwpos;
  631. } HDLAYOUT, FAR *LPHDLAYOUT;
  632.  
  633.  
  634. #define HDM_LAYOUT              (HDM_FIRST + 5)
  635. #define Header_Layout(hwndHD, playout) \
  636.     (BOOL)SNDMSG((hwndHD), HDM_LAYOUT, 0, (LPARAM)(HD_LAYOUT FAR*)(playout))
  637.  
  638.  
  639. #define HHT_NOWHERE             0x0001
  640. #define HHT_ONHEADER            0x0002
  641. #define HHT_ONDIVIDER           0x0004
  642. #define HHT_ONDIVOPEN           0x0008
  643. #define HHT_ABOVE               0x0100
  644. #define HHT_BELOW               0x0200
  645. #define HHT_TORIGHT             0x0400
  646. #define HHT_TOLEFT              0x0800
  647.  
  648. #if (_WIN32_IE >= 0x0300)
  649. #define HD_HITTESTINFO HDHITTESTINFO
  650. #else
  651. #define HDHITTESTINFO  HD_HITTESTINFO
  652. #endif
  653.  
  654. typedef struct _HD_HITTESTINFO
  655. {
  656.     POINT pt;
  657.     UINT flags;
  658.     int iItem;
  659. } HDHITTESTINFO, FAR *LPHDHITTESTINFO;
  660.  
  661.  
  662. #define HDM_HITTEST             (HDM_FIRST + 6)
  663.  
  664. #if (_WIN32_IE >= 0x0300)
  665.  
  666. #define HDM_GETITEMRECT         (HDM_FIRST + 7)
  667. #define Header_GetItemRect(hwnd, iItem, lprc) \
  668.         (BOOL)SNDMSG((hwnd), HDM_GETITEMRECT, (WPARAM)iItem, (LPARAM)lprc)
  669.  
  670. #define HDM_SETIMAGELIST        (HDM_FIRST + 8)
  671. #define Header_SetImageList(hwnd, himl) \
  672.         (HIMAGELIST)SNDMSG((hwnd), HDM_SETIMAGELIST, 0, (LPARAM)himl)
  673.  
  674. #define HDM_GETIMAGELIST        (HDM_FIRST + 9)
  675. #define Header_GetImageList(hwnd) \
  676.         (HIMAGELIST)SNDMSG((hwnd), HDM_GETIMAGELIST, 0, 0)
  677.  
  678.  
  679. #define HDM_ORDERTOINDEX        (HDM_FIRST + 15)
  680. #define Header_OrderToIndex(hwnd, i) \
  681.         (int)SNDMSG((hwnd), HDM_ORDERTOINDEX, (WPARAM)i, 0)
  682.  
  683. #define HDM_CREATEDRAGIMAGE     (HDM_FIRST + 16)  // wparam = which item (by index)
  684. #define Header_CreateDragImage(hwnd, i) \
  685.         (HIMAGELIST)SNDMSG((hwnd), HDM_CREATEDRAGIMAGE, (WPARAM)i, 0)
  686.  
  687. #define HDM_GETORDERARRAY       (HDM_FIRST + 17)
  688. #define Header_GetOrderArray(hwnd, iCount, lpi) \
  689.         (BOOL)SNDMSG((hwnd), HDM_GETORDERARRAY, (WPARAM)iCount, (LPARAM)lpi)
  690.  
  691. #define HDM_SETORDERARRAY       (HDM_FIRST + 18)
  692. #define Header_SetOrderArray(hwnd, iCount, lpi) \
  693.         (BOOL)SNDMSG((hwnd), HDM_SETORDERARRAY, (WPARAM)iCount, (LPARAM)lpi)
  694. // lparam = int array of size HDM_GETITEMCOUNT
  695. // the array specifies the order that all items should be displayed.
  696. // e.g.  { 2, 0, 1}
  697. // says the index 2 item should be shown in the 0ths position
  698. //      index 0 should be shown in the 1st position
  699. //      index 1 should be shown in the 2nd position
  700.  
  701.  
  702. #define HDM_SETHOTDIVIDER          (HDM_FIRST + 19)
  703. #define Header_SetHotDivider(hwnd, fPos, dw) \
  704.         (int)SNDMSG((hwnd), HDM_SETHOTDIVIDER, (WPARAM)fPos, (LPARAM)dw)
  705. // convenience message for external dragdrop
  706. // wParam = BOOL  specifying whether the lParam is a dwPos of the cursor
  707. //              position or the index of which divider to hotlight
  708. // lParam = depends on wParam  (-1 and wParm = FALSE turns off hotlight)
  709. #endif      // _WIN32_IE >= 0x0300
  710.  
  711. #define HDN_ITEMCHANGINGA       (HDN_FIRST-0)
  712. #define HDN_ITEMCHANGINGW       (HDN_FIRST-20)
  713. #define HDN_ITEMCHANGEDA        (HDN_FIRST-1)
  714. #define HDN_ITEMCHANGEDW        (HDN_FIRST-21)
  715. #define HDN_ITEMCLICKA          (HDN_FIRST-2)
  716. #define HDN_ITEMCLICKW          (HDN_FIRST-22)
  717. #define HDN_ITEMDBLCLICKA       (HDN_FIRST-3)
  718. #define HDN_ITEMDBLCLICKW       (HDN_FIRST-23)
  719. #define HDN_DIVIDERDBLCLICKA    (HDN_FIRST-5)
  720. #define HDN_DIVIDERDBLCLICKW    (HDN_FIRST-25)
  721. #define HDN_BEGINTRACKA         (HDN_FIRST-6)
  722. #define HDN_BEGINTRACKW         (HDN_FIRST-26)
  723. #define HDN_ENDTRACKA           (HDN_FIRST-7)
  724. #define HDN_ENDTRACKW           (HDN_FIRST-27)
  725. #define HDN_TRACKA              (HDN_FIRST-8)
  726. #define HDN_TRACKW              (HDN_FIRST-28)
  727. #if (_WIN32_IE >= 0x0300)
  728. #define HDN_GETDISPINFOA        (HDN_FIRST-9)
  729. #define HDN_GETDISPINFOW        (HDN_FIRST-29)
  730. #define HDN_BEGINDRAG           (HDN_FIRST-10)
  731. #define HDN_ENDDRAG             (HDN_FIRST-11)
  732. #endif
  733.  
  734. #ifdef UNICODE
  735. #define HDN_ITEMCHANGING         HDN_ITEMCHANGINGW
  736. #define HDN_ITEMCHANGED          HDN_ITEMCHANGEDW
  737. #define HDN_ITEMCLICK            HDN_ITEMCLICKW
  738. #define HDN_ITEMDBLCLICK         HDN_ITEMDBLCLICKW
  739. #define HDN_DIVIDERDBLCLICK      HDN_DIVIDERDBLCLICKW
  740. #define HDN_BEGINTRACK           HDN_BEGINTRACKW
  741. #define HDN_ENDTRACK             HDN_ENDTRACKW
  742. #define HDN_TRACK                HDN_TRACKW
  743. #if (_WIN32_IE >= 0x0300)
  744. #define HDN_GETDISPINFO          HDN_GETDISPINFOW
  745. #endif
  746. #else
  747. #define HDN_ITEMCHANGING         HDN_ITEMCHANGINGA
  748. #define HDN_ITEMCHANGED          HDN_ITEMCHANGEDA
  749. #define HDN_ITEMCLICK            HDN_ITEMCLICKA
  750. #define HDN_ITEMDBLCLICK         HDN_ITEMDBLCLICKA
  751. #define HDN_DIVIDERDBLCLICK      HDN_DIVIDERDBLCLICKA
  752. #define HDN_BEGINTRACK           HDN_BEGINTRACKA
  753. #define HDN_ENDTRACK             HDN_ENDTRACKA
  754. #define HDN_TRACK                HDN_TRACKA
  755. #if (_WIN32_IE >= 0x0300)
  756. #define HDN_GETDISPINFO          HDN_GETDISPINFOA
  757. #endif
  758. #endif
  759.  
  760.  
  761.  
  762. #if (_WIN32_IE >= 0x0300)
  763. #define HD_NOTIFYA              NMHEADERA
  764. #define HD_NOTIFYW              NMHEADERW
  765. #else
  766. #define tagNMHEADERA            _HD_NOTIFY
  767. #define NMHEADERA               HD_NOTIFYA
  768. #define tagHMHEADERW            _HD_NOTIFYW
  769. #define NMHEADERW               HD_NOTIFYW
  770. #endif
  771. #define HD_NOTIFY               NMHEADER
  772.  
  773. typedef struct tagNMHEADERA
  774. {
  775.     NMHDR   hdr;
  776.     int     iItem;
  777.     int     iButton;
  778.     HDITEMA FAR* pitem;
  779. }  NMHEADERA, FAR* LPNMHEADERA;
  780.  
  781.  
  782. typedef struct tagNMHEADERW
  783. {
  784.     NMHDR   hdr;
  785.     int     iItem;
  786.     int     iButton;
  787.     HDITEMW FAR* pitem;
  788. } NMHEADERW, FAR* LPNMHEADERW;
  789.  
  790. #ifdef UNICODE
  791. #define NMHEADER                NMHEADERW
  792. #define LPNMHEADER              LPNMHEADERW
  793. #else
  794. #define NMHEADER                NMHEADERA
  795. #define LPNMHEADER              LPNMHEADERA
  796. #endif
  797.  
  798. typedef struct tagNMHDDISPINFOW
  799. {
  800.     NMHDR   hdr;
  801.     int     iItem;
  802.     UINT    mask;
  803.     LPWSTR  pszText;
  804.     int     cchTextMax;
  805.     int     iImage;
  806.     LPARAM  lParam;
  807. } NMHDDISPINFOW, FAR* LPNMHDDISPINFOW;
  808.  
  809. typedef struct tagNMHDDISPINFOA
  810. {
  811.     NMHDR   hdr;
  812.     int     iItem;
  813.     UINT    mask;
  814.     LPSTR   pszText;
  815.     int     cchTextMax;
  816.     int     iImage;
  817.     LPARAM  lParam;
  818. } NMHDDISPINFOA, FAR* LPNMHDDISPINFOA;
  819.  
  820.  
  821. #ifdef UNICODE
  822. #define NMHDDISPINFO            NMHDDISPINFOW
  823. #define LPNMHDDISPINFO          LPNMHDDISPINFOW
  824. #else
  825. #define NMHDDISPINFO            NMHDDISPINFOA
  826. #define LPNMHDDISPINFO          LPNMHDDISPINFOA
  827. #endif
  828.  
  829. #endif      // NOHEADER
  830.  
  831.  
  832. //====== TOOLBAR CONTROL ======================================================
  833.  
  834. #ifndef NOTOOLBAR
  835.  
  836. #ifdef _WIN32
  837. #define TOOLBARCLASSNAMEW       L"ToolbarWindow32"
  838. #define TOOLBARCLASSNAMEA       "ToolbarWindow32"
  839.  
  840. #ifdef  UNICODE
  841. #define TOOLBARCLASSNAME        TOOLBARCLASSNAMEW
  842. #else
  843. #define TOOLBARCLASSNAME        TOOLBARCLASSNAMEA
  844. #endif
  845.  
  846. #else
  847. #define TOOLBARCLASSNAME        "ToolbarWindow"
  848. #endif
  849.  
  850. typedef struct _TBBUTTON {
  851.     int iBitmap;
  852.     int idCommand;
  853.     BYTE fsState;
  854.     BYTE fsStyle;
  855. #ifdef _WIN32
  856.     BYTE bReserved[2];
  857. #endif
  858.     DWORD dwData;
  859.     int iString;
  860. } TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
  861. typedef const TBBUTTON FAR* LPCTBBUTTON;
  862.  
  863. WINCOMMCTRLAPI HWND WINAPI CreateToolbarEx(HWND hwnd, DWORD ws, UINT wID, int nBitmaps,
  864.                         HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
  865.                         int iNumButtons, int dxButton, int dyButton,
  866.                         int dxBitmap, int dyBitmap, UINT uStructSize);
  867.  
  868. #define TBSTATE_CHECKED         0x01
  869. #define TBSTATE_PRESSED         0x02
  870. #define TBSTATE_ENABLED         0x04
  871. #define TBSTATE_HIDDEN          0x08
  872. #define TBSTATE_INDETERMINATE   0x10
  873. #define TBSTATE_WRAP            0x20
  874. #if (_WIN32_IE >= 0x0300)
  875. #define TBSTATE_ELLIPSES        0x40
  876. #endif
  877. #if (_WIN32_IE >= 0x0400)
  878. #define TBSTATE_HIGHLIGHTED     0x80
  879. #endif
  880.  
  881. #define TBSTYLE_BUTTON          0x0000
  882. #define TBSTYLE_SEP             0x0001
  883. #define TBSTYLE_CHECK           0x0002
  884. #define TBSTYLE_GROUP           0x0004
  885. #define TBSTYLE_CHECKGROUP      (TBSTYLE_GROUP | TBSTYLE_CHECK)
  886. #if (_WIN32_IE >= 0x0300)
  887. #define TBSTYLE_DROPDOWN        0x0008
  888. #endif
  889. #if (_WIN32_IE >= 0x0400)
  890. #define TBSTYLE_AUTOSIZE        0x0010 // automatically calculate the cx of the button
  891. #endif
  892.  
  893. #define TBSTYLE_TOOLTIPS        0x0100
  894. #define TBSTYLE_WRAPABLE        0x0200
  895. #define TBSTYLE_ALTDRAG         0x0400
  896. #if (_WIN32_IE >= 0x0300)
  897. #define TBSTYLE_FLAT            0x0800
  898. #define TBSTYLE_LIST            0x1000
  899. #define TBSTYLE_CUSTOMERASE     0x2000
  900. #endif
  901. #if (_WIN32_IE >= 0x0400)
  902. #define TBSTYLE_TRANSPARENT     0x8000
  903. #endif
  904.  
  905. #define TB_ENABLEBUTTON         (WM_USER + 1)
  906. #define TB_CHECKBUTTON          (WM_USER + 2)
  907. #define TB_PRESSBUTTON          (WM_USER + 3)
  908. #define TB_HIDEBUTTON           (WM_USER + 4)
  909. #define TB_INDETERMINATE        (WM_USER + 5)
  910. #if (_WIN32_IE >= 0x0400)
  911. #define TB_HIGHLIGHTBUTTON      (WM_USER + 6)
  912. #endif
  913. #define TB_ISBUTTONENABLED      (WM_USER + 9)
  914. #define TB_ISBUTTONCHECKED      (WM_USER + 10)
  915. #define TB_ISBUTTONPRESSED      (WM_USER + 11)
  916. #define TB_ISBUTTONHIDDEN       (WM_USER + 12)
  917. #define TB_ISBUTTONINDETERMINATE (WM_USER + 13)
  918. #if (_WIN32_IE >= 0x0400)
  919. #define TB_ISBUTTONHIGHLIGHTED  (WM_USER + 14)
  920. #endif
  921. #define TB_SETSTATE             (WM_USER + 17)
  922. #define TB_GETSTATE             (WM_USER + 18)
  923. #define TB_ADDBITMAP            (WM_USER + 19)
  924.  
  925. #ifdef _WIN32
  926. typedef struct tagTBADDBITMAP {
  927.         HINSTANCE       hInst;
  928.         UINT            nID;
  929. } TBADDBITMAP, *LPTBADDBITMAP;
  930.  
  931. #define HINST_COMMCTRL          ((HINSTANCE)-1)
  932. #define IDB_STD_SMALL_COLOR     0
  933. #define IDB_STD_LARGE_COLOR     1
  934. #define IDB_VIEW_SMALL_COLOR    4
  935. #define IDB_VIEW_LARGE_COLOR    5
  936.  
  937. // icon indexes for standard bitmap
  938.  
  939. #define STD_CUT                 0
  940. #define STD_COPY                1
  941. #define STD_PASTE               2
  942. #define STD_UNDO                3
  943. #define STD_REDOW               4
  944. #define STD_DELETE              5
  945. #define STD_FILENEW             6
  946. #define STD_FILEOPEN            7
  947. #define STD_FILESAVE            8
  948. #define STD_PRINTPRE            9
  949. #define STD_PROPERTIES          10
  950. #define STD_HELP                11
  951. #define STD_FIND                12
  952. #define STD_REPLACE             13
  953. #define STD_PRINT               14
  954.  
  955. // icon indexes for standard view bitmap
  956.  
  957. #define VIEW_LARGEICONS         0
  958. #define VIEW_SMALLICONS         1
  959. #define VIEW_LIST               2
  960. #define VIEW_DETAILS            3
  961. #define VIEW_SORTNAME           4
  962. #define VIEW_SORTSIZE           5
  963. #define VIEW_SORTDATE           6
  964. #define VIEW_SORTTYPE           7
  965. #define VIEW_PARENTFOLDER       8
  966. #define VIEW_NETCONNECT         9
  967. #define VIEW_NETDISCONNECT      10
  968. #define VIEW_NEWFOLDER          11
  969.  
  970. #endif
  971.  
  972. #if (_WIN32_IE >= 0x0400)
  973. #define TB_ADDBUTTONSA          (WM_USER + 20)
  974. #define TB_INSERTBUTTONA        (WM_USER + 21)
  975. #else
  976. #define TB_ADDBUTTONS           (WM_USER + 20)
  977. #define TB_INSERTBUTTON         (WM_USER + 21)
  978. #endif
  979.  
  980. #define TB_DELETEBUTTON         (WM_USER + 22)
  981. #define TB_GETBUTTON            (WM_USER + 23)
  982. #define TB_BUTTONCOUNT          (WM_USER + 24)
  983. #define TB_COMMANDTOINDEX       (WM_USER + 25)
  984.  
  985. #define TB_ADDSTRINGA           (WM_USER + 28)
  986. #define TB_ADDSTRINGW           (WM_USER + 77)
  987. #define TB_GETITEMRECT          (WM_USER + 29)
  988. #define TB_BUTTONSTRUCTSIZE     (WM_USER + 30)
  989. #define TB_SETBUTTONSIZE        (WM_USER + 31)
  990. #define TB_SETBITMAPSIZE        (WM_USER + 32)
  991. #define TB_AUTOSIZE             (WM_USER + 33)
  992. #define TB_GETTOOLTIPS          (WM_USER + 35)
  993. #ifndef UNDER_CE // TB_SETTOOLTIPS is used differently on WinCE, so its definition has changed
  994. #define TB_SETTOOLTIPS          (WM_USER + 36)
  995. #else
  996. #define TB_SETTOOLTIPS          (WM_USER + 81)
  997. #endif // !UNDER_CE
  998. #define TB_SETPARENT            (WM_USER + 37)
  999. #define TB_SETROWS              (WM_USER + 39)
  1000. #define TB_GETROWS              (WM_USER + 40)
  1001. #define TB_SETCMDID             (WM_USER + 42)
  1002. #define TB_CHANGEBITMAP         (WM_USER + 43)
  1003. #define TB_GETBITMAP            (WM_USER + 44)
  1004. #define TB_GETBUTTONTEXTA       (WM_USER + 45)
  1005. #define TB_GETBUTTONTEXTW       (WM_USER + 75)
  1006. #define TB_REPLACEBITMAP        (WM_USER + 46)
  1007. #if (_WIN32_IE >= 0x0300)
  1008. #define TB_SETINDENT            (WM_USER + 47)
  1009. #define TB_SETIMAGELIST         (WM_USER + 48)
  1010. #define TB_GETIMAGELIST         (WM_USER + 49)
  1011. #define TB_LOADIMAGES           (WM_USER + 50)
  1012. #define TB_GETRECT              (WM_USER + 51) // wParam is the Cmd instead of index
  1013. #define TB_SETDISABLEDIMAGELIST (WM_USER + 54)
  1014. #define TB_GETDISABLEDIMAGELIST (WM_USER + 55)
  1015. #define TB_SETSTYLE             (WM_USER + 56)
  1016. #define TB_GETSTYLE             (WM_USER + 57)
  1017. #define TB_GETBUTTONSIZE        (WM_USER + 58)
  1018. #define TB_SETBUTTONWIDTH       (WM_USER + 59)
  1019. #define TB_SETMAXTEXTROWS       (WM_USER + 60)
  1020. #define TB_GETTEXTROWS          (WM_USER + 61)
  1021. #endif      // _WIN32_IE >= 0x0300
  1022.  
  1023. #ifdef UNICODE
  1024. #define TB_GETBUTTONTEXT        TB_GETBUTTONTEXTW
  1025. #define TB_SAVERESTORE          TB_SAVERESTOREW
  1026. #define TB_ADDSTRING            TB_ADDSTRINGW
  1027. #else
  1028. #define TB_GETBUTTONTEXT        TB_GETBUTTONTEXTA
  1029. #define TB_SAVERESTORE          TB_SAVERESTOREA
  1030. #define TB_ADDSTRING            TB_ADDSTRINGA
  1031. #endif
  1032.  
  1033. typedef struct {
  1034.     HINSTANCE       hInstOld;
  1035.     UINT            nIDOld;
  1036.     HINSTANCE       hInstNew;
  1037.     UINT            nIDNew;
  1038.     int             nButtons;
  1039. } TBREPLACEBITMAP, *LPTBREPLACEBITMAP;
  1040.  
  1041. #ifdef _WIN32
  1042.  
  1043. #define TBBF_LARGE              0x0001
  1044.  
  1045. #define TB_GETBITMAPFLAGS       (WM_USER + 41)
  1046.  
  1047. #if (_WIN32_IE >= 0x0400)
  1048. #define TBIF_IMAGE              0x00000001
  1049. #define TBIF_TEXT               0x00000002
  1050. #define TBIF_STATE              0x00000004
  1051. #define TBIF_STYLE              0x00000008
  1052. #define TBIF_LPARAM             0x00000010
  1053. #define TBIF_COMMAND            0x00000020
  1054. #define TBIF_SIZE               0x00000040
  1055.  
  1056. typedef struct {
  1057.     UINT cbSize;
  1058.     DWORD dwMask;
  1059.     int idCommand;
  1060.     int iImage;
  1061.     BYTE fsState;
  1062.     BYTE fsStyle;
  1063.     WORD cx;
  1064.     DWORD lParam;
  1065.     LPSTR pszText;
  1066.     int cchText;
  1067. } TBBUTTONINFOA, *LPTBBUTTONINFOA;
  1068.  
  1069. typedef struct {
  1070.     UINT cbSize;
  1071.     DWORD dwMask;
  1072.     int idCommand;
  1073.     int iImage;
  1074.     BYTE fsState;
  1075.     BYTE fsStyle;
  1076.     WORD cx;
  1077.     DWORD lParam;
  1078.     LPWSTR pszText;
  1079.     int cchText;
  1080. } TBBUTTONINFOW, *LPTBBUTTONINFOW;
  1081.  
  1082. #ifdef UNICODE
  1083. #define TBBUTTONINFO TBBUTTONINFOW
  1084. #define LPTBBUTTONINFO LPTBBUTTONINFOW
  1085. #else
  1086. #define TBBUTTONINFO TBBUTTONINFOA
  1087. #define LPTBBUTTONINFO LPTBBUTTONINFOA
  1088. #endif
  1089.  
  1090.  
  1091. // BUTTONINFO APIs do NOT support the string pool.
  1092. #define TB_GETBUTTONINFOW        (WM_USER + 63)
  1093. #define TB_SETBUTTONINFOW        (WM_USER + 64)
  1094. #define TB_GETBUTTONINFOA        (WM_USER + 65)
  1095. #define TB_SETBUTTONINFOA        (WM_USER + 66)
  1096. #ifdef UNICODE
  1097. #define TB_GETBUTTONINFO        TB_GETBUTTONINFOW
  1098. #define TB_SETBUTTONINFO        TB_SETBUTTONINFOW
  1099. #else
  1100. #define TB_GETBUTTONINFO        TB_GETBUTTONINFOA
  1101. #define TB_SETBUTTONINFO        TB_SETBUTTONINFOA
  1102. #endif
  1103.  
  1104.  
  1105. #define TB_INSERTBUTTONW        (WM_USER + 67)
  1106. #define TB_ADDBUTTONSW          (WM_USER + 68)
  1107.  
  1108. #define TB_HITTEST              (WM_USER + 69)
  1109.  
  1110.  
  1111. // New post Win95/NT4 for InsertButton and AddButton.  if iString member 
  1112. // is a pointer to a string, it will be handled as a string like listview
  1113. // (although LPSTR_TEXTCALLBACK is not supported).
  1114. #ifdef UNICODE
  1115. #define TB_INSERTBUTTON         TB_INSERTBUTTONW
  1116. #define TB_ADDBUTTONS           TB_ADDBUTTONSW
  1117. #else
  1118. #define TB_INSERTBUTTON         TB_INSERTBUTTONA
  1119. #define TB_ADDBUTTONS           TB_ADDBUTTONSA
  1120. #endif
  1121.  
  1122. #define TB_SETDRAWTEXTFLAGS     (WM_USER + 70)  // wParam == mask lParam == bit values
  1123.  
  1124. #endif         // _WIN32_IE >= 0x0400
  1125.  
  1126. #define TBN_GETBUTTONINFOA      (TBN_FIRST-0)
  1127. #define TBN_GETBUTTONINFOW      (TBN_FIRST-20)
  1128. #define TBN_BEGINDRAG           (TBN_FIRST-1)
  1129. #define TBN_ENDDRAG             (TBN_FIRST-2)
  1130. #if (_WIN32_IE >= 0x0300)
  1131. #define TBN_DROPDOWN            (TBN_FIRST - 10)
  1132. #endif
  1133. #if (_WIN32_IE >= 0x0400)
  1134. #define TBN_DRAGOUT             (TBN_FIRST - 14) // this is sent when the user clicks down on a button then drags off the button
  1135. #endif
  1136.  
  1137. #ifdef UNICODE
  1138. #define TBN_GETBUTTONINFO       TBN_GETBUTTONINFOW
  1139. #else
  1140. #define TBN_GETBUTTONINFO       TBN_GETBUTTONINFOA
  1141. #endif
  1142.  
  1143. #if (_WIN32_IE >= 0x0300)
  1144. #define TBNOTIFYA NMTOOLBARA
  1145. #define TBNOTIFYW NMTOOLBARW
  1146. #define LPTBNOTIFYA LPNMTOOLBARA
  1147. #define LPTBNOTIFYW LPNMTOOLBARW
  1148. #else
  1149. #define tagNMTOOLBARA  tagTBNOTIFYA
  1150. #define NMTOOLBARA     TBNOTIFYA
  1151. #define LPNMTOOLBARA   LPTBNOTIFYA
  1152. #define tagNMTOOLBARW  tagTBNOTIFYW
  1153. #define NMTOOLBARW     TBNOTIFYW
  1154. #define LPNMTOOLBARW   LPTBNOTIFYW
  1155. #endif
  1156.  
  1157. #define TBNOTIFY       NMTOOLBAR
  1158. #define LPTBNOTIFY     LPNMTOOLBAR
  1159.  
  1160. typedef struct tagNMTOOLBARA {
  1161. #if (_WIN32_IE >= 0x0300)
  1162.     NMHDR   hdr;
  1163. #endif
  1164.     int     iItem;
  1165.     TBBUTTON tbButton;
  1166.     int     cchText;
  1167.     LPSTR   pszText;
  1168. } NMTOOLBARA, FAR* LPNMTOOLBARA;
  1169.  
  1170.  
  1171. typedef struct tagNMTOOLBARW {
  1172. #if (_WIN32_IE >= 0x0300)
  1173.     NMHDR   hdr;
  1174. #endif
  1175.     int     iItem;
  1176.     TBBUTTON tbButton;
  1177.     int     cchText;
  1178.     LPWSTR   pszText;
  1179. } NMTOOLBARW, FAR* LPNMTOOLBARW;
  1180.  
  1181.  
  1182. #ifdef UNICODE
  1183. #define NMTOOLBAR               NMTOOLBARW
  1184. #define LPNMTOOLBAR             LPNMTOOLBARW
  1185. #else
  1186. #define NMTOOLBAR               NMTOOLBARA
  1187. #define LPNMTOOLBAR             LPNMTOOLBARA
  1188. #endif
  1189.  
  1190. #endif
  1191.  
  1192. #endif      // NOTOOLBAR
  1193.  
  1194.  
  1195. #if (_WIN32_IE >= 0x0300)
  1196. //====== REBAR CONTROL ========================================================
  1197.  
  1198. #ifndef NOREBAR
  1199.  
  1200. #ifdef _WIN32
  1201. #define REBARCLASSNAMEW         L"ReBarWindow32"
  1202. #define REBARCLASSNAMEA         "ReBarWindow32"
  1203.  
  1204. #ifdef  UNICODE
  1205. #define REBARCLASSNAME          REBARCLASSNAMEW
  1206. #else
  1207. #define REBARCLASSNAME          REBARCLASSNAMEA
  1208. #endif
  1209.  
  1210. #else
  1211. #define REBARCLASSNAME          "ReBarWindow"
  1212. #endif
  1213.  
  1214. #define RBIM_IMAGELIST  0x00000001
  1215.  
  1216. #if (_WIN32_IE >= 0x0400)
  1217. #define RBS_VARHEIGHT       0x0200
  1218. #define RBS_BANDBORDERS     0x0400
  1219. #define RBS_FIXEDORDER      0x0800
  1220. #ifndef UNDER_CE // WinCE doesn't support RBS_REGISTERDROP
  1221. #define RBS_REGISTERDROP    0x1000
  1222. #else
  1223. #define RBS_SMARTLABELS     0x1000
  1224. #endif // UNDER_CE
  1225. #define RBS_AUTOSIZE        0x2000
  1226. #define RBS_VERTICALGRIPPER  0x4000  // this always has the vertical gripper (default for horizontal mode)
  1227. #else
  1228. #define RBS_VARHEIGHT       0x00000200
  1229. #define RBS_BANDBORDERS     0x00000400
  1230. #define RBS_FIXEDORDER      0x00000800
  1231. #endif      // _WIN32_IE >= 0x0400
  1232.  
  1233.  
  1234. typedef struct tagREBARINFO
  1235. {
  1236.     UINT        cbSize;
  1237.     UINT        fMask;
  1238. #ifndef NOIMAGEAPIS
  1239.     HIMAGELIST  himl;
  1240. #else
  1241.     HANDLE      himl;
  1242. #endif
  1243. }   REBARINFO, FAR *LPREBARINFO;
  1244.  
  1245. #define RBBS_BREAK          0x00000001  // break to new line
  1246. #define RBBS_FIXEDSIZE      0x00000002  // band can't be sized
  1247. #define RBBS_CHILDEDGE      0x00000004  // edge around top & bottom of child window
  1248. #define RBBS_HIDDEN         0x00000008  // don't show
  1249. #define RBBS_NOVERT         0x00000010  // don't show when vertical
  1250. #define RBBS_FIXEDBMP       0x00000020  // bitmap doesn't move during band resize
  1251. #if (_WIN32_IE >= 0x0400)
  1252. #define RBBS_VARIABLEHEIGHT 0x00000040  // allow autosizing of this child vertically
  1253. #define RBBS_GRIPPERALWAYS  0x00000080  // always show the gripper
  1254. #ifdef UNDER_CE
  1255. #define RBBS_NOGRIPPER      0x00000100  // never show gripper for this band
  1256. #endif // UNDER_CE
  1257. #endif
  1258.  
  1259. #define RBBIM_STYLE         0x00000001
  1260. #define RBBIM_COLORS        0x00000002
  1261. #define RBBIM_TEXT          0x00000004
  1262. #define RBBIM_IMAGE         0x00000008
  1263. #define RBBIM_CHILD         0x00000010
  1264. #define RBBIM_CHILDSIZE     0x00000020
  1265. #define RBBIM_SIZE          0x00000040
  1266. #define RBBIM_BACKGROUND    0x00000080
  1267. #define RBBIM_ID            0x00000100
  1268. #if (_WIN32_IE >= 0x0400)
  1269. #define RBBIM_IDEALSIZE     0x00000200
  1270. #define RBBIM_LPARAM        0x00000400
  1271. #endif
  1272.  
  1273. typedef struct tagREBARBANDINFOA
  1274. {
  1275.     UINT        cbSize;
  1276.     UINT        fMask;
  1277.     UINT        fStyle;
  1278.     COLORREF    clrFore;
  1279.     COLORREF    clrBack;
  1280.     LPSTR       lpText;
  1281.     UINT        cch;
  1282.     int         iImage;
  1283.     HWND        hwndChild;
  1284.     UINT        cxMinChild;
  1285.     UINT        cyMinChild;
  1286.     UINT        cx;
  1287.     HBITMAP     hbmBack;
  1288.     UINT        wID;
  1289. #if (_WIN32_IE >= 0x0400)
  1290.     UINT        cyChild;
  1291.     UINT        cyMaxChild;
  1292.     UINT        cyIntegral;
  1293.     UINT        cxIdeal;
  1294.     LPARAM      lParam;
  1295. #endif
  1296. }   REBARBANDINFOA, FAR *LPREBARBANDINFOA;
  1297. typedef REBARBANDINFOA CONST FAR *LPCREBARBANDINFOA;
  1298.  
  1299. typedef struct tagREBARBANDINFOW
  1300. {
  1301.     UINT        cbSize;
  1302.     UINT        fMask;
  1303.     UINT        fStyle;
  1304.     COLORREF    clrFore;
  1305.     COLORREF    clrBack;
  1306.     LPWSTR      lpText;
  1307.     UINT        cch;
  1308.     int         iImage;
  1309.     HWND        hwndChild;
  1310.     UINT        cxMinChild;
  1311.     UINT        cyMinChild;
  1312.     UINT        cx;
  1313.     HBITMAP     hbmBack;
  1314.     UINT        wID;
  1315. #if (_WIN32_IE >= 0x0400)
  1316.     UINT        cyChild;
  1317.     UINT        cyMaxChild;
  1318.     UINT        cyIntegral;
  1319.     UINT        cxIdeal;
  1320.     LPARAM      lParam;
  1321. #endif
  1322. }   REBARBANDINFOW, FAR *LPREBARBANDINFOW;
  1323. typedef REBARBANDINFOW CONST FAR *LPCREBARBANDINFOW;
  1324.  
  1325. #ifdef UNICODE
  1326. #define REBARBANDINFO       REBARBANDINFOW
  1327. #define LPREBARBANDINFO     LPREBARBANDINFOW
  1328. #define LPCREBARBANDINFO    LPCREBARBANDINFOW
  1329. #else
  1330. #define REBARBANDINFO       REBARBANDINFOA
  1331. #define LPREBARBANDINFO     LPREBARBANDINFOA
  1332. #define LPCREBARBANDINFO    LPCREBARBANDINFOA
  1333. #endif
  1334.  
  1335. #define RB_INSERTBANDA  (WM_USER +  1)
  1336. #define RB_DELETEBAND   (WM_USER +  2)
  1337. #define RB_GETBARINFO   (WM_USER +  3)
  1338. #define RB_SETBARINFO   (WM_USER +  4)
  1339. #if (_WIN32_IE < 0x0400)
  1340. #define RB_GETBANDINFO  (WM_USER +  5)
  1341. #endif
  1342. #define RB_SETBANDINFOA (WM_USER +  6)
  1343. #define RB_SETPARENT    (WM_USER +  7)
  1344. #if (_WIN32_IE >= 0x0400)
  1345. #define RB_HITTEST      (WM_USER +  8)
  1346. #define RB_GETRECT      (WM_USER +  9)
  1347. #endif
  1348. #define RB_INSERTBANDW  (WM_USER +  10)
  1349. #define RB_SETBANDINFOW (WM_USER +  11)
  1350. #define RB_GETBANDCOUNT (WM_USER +  12)
  1351. #define RB_GETROWCOUNT  (WM_USER +  13)
  1352. #define RB_GETROWHEIGHT (WM_USER +  14)
  1353. #if (_WIN32_IE >= 0x0400)
  1354. #define RB_IDTOINDEX    (WM_USER +  16) // wParam == id
  1355. #define RB_SETBKCOLOR   (WM_USER +  19) // sets the default BK color
  1356. #define RB_GETBKCOLOR   (WM_USER +  20) // defaults to CLR_NONE
  1357. #define RB_SETTEXTCOLOR (WM_USER +  21)
  1358. #define RB_GETTEXTCOLOR (WM_USER +  22) // defaults to 0x00000000
  1359. #define RB_SIZETORECT   (WM_USER +  23) // resize the rebar/break bands and such to this rect (lparam)
  1360. #endif      // _WIN32_IE >= 0x0400
  1361.  
  1362. #ifdef UNICODE
  1363. #define RB_INSERTBAND   RB_INSERTBANDW
  1364. #define RB_SETBANDINFO   RB_SETBANDINFOW
  1365. #else
  1366. #define RB_INSERTBAND   RB_INSERTBANDA
  1367. #define RB_SETBANDINFO   RB_SETBANDINFOA
  1368. #endif
  1369.  
  1370. #if (_WIN32_IE >= 0x0400)
  1371. // for manual drag control
  1372. // lparam == cursor pos
  1373.         // -1 means do it yourself.
  1374.         // -2 means use what you had saved before
  1375. #define RB_BEGINDRAG    (WM_USER + 24)
  1376. #define RB_ENDDRAG      (WM_USER + 25)
  1377. #define RB_DRAGMOVE     (WM_USER + 26)
  1378. #define RB_GETBARHEIGHT (WM_USER + 27)
  1379. #define RB_GETBANDINFOW (WM_USER + 28)
  1380. #define RB_GETBANDINFOA (WM_USER + 29)
  1381.  
  1382. #ifdef UNICODE
  1383. #define RB_GETBANDINFO   RB_GETBANDINFOW
  1384. #else
  1385. #define RB_GETBANDINFO   RB_GETBANDINFOA
  1386. #endif
  1387.  
  1388. #define RB_MINIMIZEBAND (WM_USER + 30)
  1389. #define RB_MAXIMIZEBAND (WM_USER + 31)
  1390.  
  1391. #define RB_GETBANDBORDERS (WM_USER + 34)  // returns in lparam = lprc the amount of edges added to band wparam
  1392.  
  1393. #define RB_SHOWBAND     (WM_USER + 35)      // show/hide band
  1394.  
  1395. #endif      // _WIN32_IE >= 0x0400
  1396.  
  1397. #define RBN_HEIGHTCHANGE    (RBN_FIRST - 0)
  1398.  
  1399. #if (_WIN32_IE >= 0x0400)
  1400. #define RBN_LAYOUTCHANGED   (RBN_FIRST - 2)
  1401. #define RBN_AUTOSIZE        (RBN_FIRST - 3)
  1402. #define RBN_BEGINDRAG       (RBN_FIRST - 4)
  1403. #define RBN_ENDDRAG         (RBN_FIRST - 5)
  1404.  
  1405.  
  1406. typedef struct tagNMREBAR
  1407. {
  1408.         NMHDR hdr;
  1409.         UINT uBand;
  1410.         UINT wID;
  1411.         UINT cyChild;
  1412.         UINT cyBand;
  1413. } NMREBAR, *LPNMREBAR;
  1414.  
  1415. typedef struct tagNMRBAUTOSIZE
  1416. {
  1417.         NMHDR hdr;
  1418.         BOOL fChanged;
  1419.         RECT rcTarget;
  1420.         RECT rcActual;
  1421. } NMRBAUTOSIZE, *LPNMRBAUTOSIZE;
  1422.  
  1423. #define RBHT_NOWHERE    0x0001
  1424. #define RBHT_CAPTION    0x0002
  1425. #define RBHT_CLIENT     0x0003
  1426. #define RBHT_GRABBER    0x0004
  1427.  
  1428. typedef struct _RB_HITTESTINFO
  1429. {
  1430.     POINT pt;
  1431.     UINT flags;
  1432.     int iBand;
  1433. } RBHITTESTINFO, FAR *LPRBHITTESTINFO;
  1434.  
  1435. #endif      // _WIN32_IE >= 0x0400
  1436.  
  1437. #endif      // NOREBAR
  1438.  
  1439. #endif      // _WIN32_IE >= 0x0300
  1440.  
  1441. //====== COMMANDBAR CONTROL =================================================
  1442.  
  1443. #ifdef UNDER_CE
  1444. #ifndef NOCOMMANDBAR
  1445.  
  1446. // Command Bar API's
  1447.  
  1448. typedef struct tagCOMMANDBANDSRESTOREINFO
  1449. {
  1450.     UINT        cbSize;
  1451.     UINT        wID;
  1452.     UINT        fStyle;
  1453.     UINT        cxRestored;
  1454.     BOOL        fMaximized;
  1455. } COMMANDBANDSRESTOREINFO, *LPCOMMANDBANDSRESTOREINFO;
  1456. typedef COMMANDBANDSRESTOREINFO CONST *LPCCOMMANDBANDSRESTOREINFO;
  1457.     
  1458. WINCOMMCTRLAPI HWND  WINAPI CommandBar_Create(HINSTANCE hInst, HWND hwndParent, int idCmdBar);
  1459. WINCOMMCTRLAPI BOOL  WINAPI CommandBar_Show(HWND hwndCB, BOOL fShow);
  1460. WINCOMMCTRLAPI int   WINAPI CommandBar_AddBitmap(HWND hwndCB, HINSTANCE hInst, int idBitmap,
  1461.                                   int iNumImages, int iImageWidth,
  1462.                                   int iImageHeight);
  1463. WINCOMMCTRLAPI HWND  WINAPI CommandBar_InsertComboBox(HWND hwndCB, HINSTANCE hInstance,
  1464.                                        int  iWidth, UINT dwStyle,
  1465.                                        WORD idComboBox, WORD iButton);
  1466. WINCOMMCTRLAPI BOOL  WINAPI CommandBar_InsertMenubar(HWND hwndCB, HINSTANCE hInst,
  1467.                                       WORD idMenu, WORD iButton);
  1468. WINCOMMCTRLAPI BOOL WINAPI CommandBar_InsertMenubarEx(HWND hwndCB,
  1469.                                        HINSTANCE hinst,
  1470.                                        LPTSTR pszMenu,
  1471.                                        WORD iButton);
  1472. WINCOMMCTRLAPI BOOL WINAPI CommandBar_DrawMenuBar(HWND hwndCB,
  1473.                                                   WORD iButton);
  1474. WINCOMMCTRLAPI HMENU WINAPI CommandBar_GetMenu(HWND hwndCB, WORD iButton);
  1475. WINCOMMCTRLAPI BOOL  WINAPI CommandBar_AddAdornments(HWND hwndCB,
  1476.                                                      DWORD dwFlags,
  1477.                                                      DWORD dwReserved);
  1478. WINCOMMCTRLAPI int   WINAPI CommandBar_Height(HWND hwndCB);
  1479. WINCOMMCTRLAPI BOOL  WINAPI IsCommandBarMessage(HWND hwndCB, LPMSG lpMsg);
  1480.  
  1481.  
  1482. WINCOMMCTRLAPI HWND WINAPI CommandBands_Create(HINSTANCE hinst, 
  1483.                                                HWND hwndParent, 
  1484.                                                UINT wID, 
  1485.                                                DWORD dwStyles, 
  1486.                                                HIMAGELIST himl);
  1487. WINCOMMCTRLAPI BOOL WINAPI CommandBands_AddBands(HWND hwndCmdBands,  
  1488.                                                  HINSTANCE hinst,
  1489.                                                  UINT cBands, 
  1490.                                                  LPREBARBANDINFO prbbi);
  1491. WINCOMMCTRLAPI HWND WINAPI CommandBands_GetCommandBar(HWND hwndCmdBands, UINT uBand);
  1492. WINCOMMCTRLAPI BOOL WINAPI CommandBands_AddAdornments(HWND hwndCmdBands, 
  1493.                                                       HINSTANCE hinst, 
  1494.                                                       DWORD dwFlags, 
  1495.                                                       LPREBARBANDINFO prbbi);
  1496. WINCOMMCTRLAPI BOOL WINAPI CommandBands_Show(HWND hwndCmdBands, BOOL fShow);
  1497. WINCOMMCTRLAPI BOOL WINAPI CommandBands_GetRestoreInformation(HWND hwndCmdBands, 
  1498.                                                UINT uBand, 
  1499.                                                LPCOMMANDBANDSRESTOREINFO pcbri);
  1500.  
  1501. // Command Bar Helper Macros
  1502.  
  1503. #define CommandBar_Destroy(hwndCB) \
  1504.     DestroyWindow((hwndCB))
  1505.  
  1506. #define CommandBar_IsVisible(hwndCB) \
  1507.     IsWindowVisible((hwndCB))    
  1508.  
  1509. #define CommandBar_AddButtons(hwndCB, cbButtons, lpButtons) \
  1510.     SendMessage((hwndCB), TB_ADDBUTTONS, (WPARAM)(cbButtons), \
  1511.                 (LPARAM)(lpButtons))
  1512.  
  1513. #define CommandBar_InsertButton(hwndCB, iButton, lpButton) \
  1514.     SendMessage((hwndCB), TB_INSERTBUTTON, (WPARAM)(iButton), \
  1515.                 (LPARAM)(lpButton))
  1516.  
  1517. #define CommandBar_AddToolTips(hwndCB, cbToolTips, lpToolTipsStrings) \
  1518.     SendMessage((hwndCB), TB_SETTOOLTIPS, (WPARAM)(cbToolTips), \
  1519.                 (LPARAM)(lpToolTipsStrings))
  1520.  
  1521. #define CommandBands_Height(hwndCmdBands)\
  1522.     ((UINT) SendMessage((hwndCmdBands), RB_GETBARHEIGHT, 0, 0))
  1523.  
  1524. #define CommandBands_IsVisible(hwndCmdBands) \
  1525.     IsWindowVisible((hwndCmdBands))
  1526.  
  1527. #define CMDBAR_HELP     0x000b
  1528. #define CMDBAR_OK        0xf000
  1529.  
  1530. #endif // NOCOMMANDBAR
  1531. #endif // UNDER_CE
  1532.  
  1533. //====== STATUS BAR CONTROL ===================================================
  1534.  
  1535. #ifndef NOSTATUSBAR
  1536.  
  1537. // begin_r_commctrl
  1538.  
  1539. // end_r_commctrl
  1540.  
  1541. WINCOMMCTRLAPI void WINAPI DrawStatusTextA(HDC hDC, LPRECT lprc, LPCSTR pszText, UINT uFlags);
  1542. WINCOMMCTRLAPI void WINAPI DrawStatusTextW(HDC hDC, LPRECT lprc, LPCWSTR pszText, UINT uFlags);
  1543.  
  1544. WINCOMMCTRLAPI HWND WINAPI CreateStatusWindowA(LONG style, LPCSTR lpszText, HWND hwndParent, UINT wID);
  1545. WINCOMMCTRLAPI HWND WINAPI CreateStatusWindowW(LONG style, LPCWSTR lpszText, HWND hwndParent, UINT wID);
  1546.  
  1547. #ifdef UNICODE
  1548. #define CreateStatusWindow      CreateStatusWindowW
  1549. #define DrawStatusText          DrawStatusTextW
  1550. #else
  1551. #define CreateStatusWindow      CreateStatusWindowA
  1552. #define DrawStatusText          DrawStatusTextA
  1553. #endif
  1554.  
  1555. #ifdef _WIN32
  1556. #define STATUSCLASSNAMEW        L"msctls_statusbar32"
  1557. #define STATUSCLASSNAMEA        "msctls_statusbar32"
  1558.  
  1559. #ifdef UNICODE
  1560. #define STATUSCLASSNAME         STATUSCLASSNAMEW
  1561. #else
  1562. #define STATUSCLASSNAME         STATUSCLASSNAMEA
  1563. #endif
  1564.  
  1565. #else
  1566. #define STATUSCLASSNAME         "msctls_statusbar"
  1567. #endif
  1568.  
  1569. #define SB_SETTEXTA             (WM_USER+1)
  1570. #define SB_SETTEXTW             (WM_USER+11)
  1571. #define SB_GETTEXTA             (WM_USER+2)
  1572. #define SB_GETTEXTW             (WM_USER+13)
  1573. #define SB_GETTEXTLENGTHA       (WM_USER+3)
  1574. #define SB_GETTEXTLENGTHW       (WM_USER+12)
  1575.  
  1576. #ifdef UNICODE
  1577. #define SB_GETTEXT              SB_GETTEXTW
  1578. #define SB_SETTEXT              SB_SETTEXTW
  1579. #define SB_GETTEXTLENGTH        SB_GETTEXTLENGTHW
  1580. #else
  1581. #define SB_GETTEXT              SB_GETTEXTA
  1582. #define SB_SETTEXT              SB_SETTEXTA
  1583. #define SB_GETTEXTLENGTH        SB_GETTEXTLENGTHA
  1584. #endif
  1585.  
  1586.  
  1587. #define SB_SETPARTS             (WM_USER+4)
  1588. #define SB_GETPARTS             (WM_USER+6)
  1589. #define SB_GETBORDERS           (WM_USER+7)
  1590. #define SB_SETMINHEIGHT         (WM_USER+8)
  1591. #define SB_SIMPLE               (WM_USER+9)
  1592. #define SB_GETRECT              (WM_USER+10)
  1593. #if (_WIN32_IE >= 0x0300)
  1594. #define SB_ISSIMPLE             (WM_USER+14)
  1595. #endif
  1596.  
  1597.  
  1598.  
  1599. #define SBT_OWNERDRAW            0x1000
  1600. #define SBT_NOBORDERS            0x0100
  1601. #define SBT_POPOUT               0x0200
  1602. #define SBT_RTLREADING           0x0400
  1603.  
  1604. /// status bar notifications
  1605. #if (_WIN32_IE >= 0x0400)
  1606. #define SBN_SIMPLEMODECHANGE    (SBN_FIRST - 0)
  1607. #endif
  1608.  
  1609. #endif      // NOSTATUSBAR
  1610.  
  1611. //====== TRACKBAR CONTROL =====================================================
  1612.  
  1613. #ifndef NOTRACKBAR
  1614.  
  1615. #ifdef _WIN32
  1616.  
  1617. #define TRACKBAR_CLASSA         "msctls_trackbar32"
  1618. #define TRACKBAR_CLASSW         L"msctls_trackbar32"
  1619.  
  1620. #ifdef UNICODE
  1621. #define  TRACKBAR_CLASS         TRACKBAR_CLASSW
  1622. #else
  1623. #define  TRACKBAR_CLASS         TRACKBAR_CLASSA
  1624. #endif
  1625.  
  1626. #else
  1627. #define TRACKBAR_CLASS          "msctls_trackbar"
  1628. #endif
  1629.  
  1630.  
  1631. // begin_r_commctrl
  1632.  
  1633. #define TBS_AUTOTICKS           0x0001
  1634. #define TBS_VERT                0x0002
  1635. #define TBS_HORZ                0x0000
  1636. #define TBS_TOP                 0x0004
  1637. #define TBS_BOTTOM              0x0000
  1638. #define TBS_LEFT                0x0004
  1639. #define TBS_RIGHT               0x0000
  1640. #define TBS_BOTH                0x0008
  1641. #define TBS_NOTICKS             0x0010
  1642. #define TBS_ENABLESELRANGE      0x0020
  1643. #define TBS_FIXEDLENGTH         0x0040
  1644. #define TBS_NOTHUMB             0x0080
  1645.  
  1646. // end_r_commctrl
  1647.  
  1648. #define TBM_GETPOS              (WM_USER)
  1649. #define TBM_GETRANGEMIN         (WM_USER+1)
  1650. #define TBM_GETRANGEMAX         (WM_USER+2)
  1651. #define TBM_GETTIC              (WM_USER+3)
  1652. #define TBM_SETTIC              (WM_USER+4)
  1653. #define TBM_SETPOS              (WM_USER+5)
  1654. #define TBM_SETRANGE            (WM_USER+6)
  1655. #define TBM_SETRANGEMIN         (WM_USER+7)
  1656. #define TBM_SETRANGEMAX         (WM_USER+8)
  1657. #define TBM_CLEARTICS           (WM_USER+9)
  1658. #define TBM_SETSEL              (WM_USER+10)
  1659. #define TBM_SETSELSTART         (WM_USER+11)
  1660. #define TBM_SETSELEND           (WM_USER+12)
  1661. #define TBM_GETPTICS            (WM_USER+14)
  1662. #define TBM_GETTICPOS           (WM_USER+15)
  1663. #define TBM_GETNUMTICS          (WM_USER+16)
  1664. #define TBM_GETSELSTART         (WM_USER+17)
  1665. #define TBM_GETSELEND           (WM_USER+18)
  1666. #define TBM_CLEARSEL            (WM_USER+19)
  1667. #define TBM_SETTICFREQ          (WM_USER+20)
  1668. #define TBM_SETPAGESIZE         (WM_USER+21)
  1669. #define TBM_GETPAGESIZE         (WM_USER+22)
  1670. #define TBM_SETLINESIZE         (WM_USER+23)
  1671. #define TBM_GETLINESIZE         (WM_USER+24)
  1672. #define TBM_GETTHUMBRECT        (WM_USER+25)
  1673. #define TBM_GETCHANNELRECT      (WM_USER+26)
  1674. #define TBM_SETTHUMBLENGTH      (WM_USER+27)
  1675. #define TBM_GETTHUMBLENGTH      (WM_USER+28)
  1676. #if (_WIN32_IE >= 0x0300)
  1677. #define TBM_SETBUDDY            (WM_USER+32) // wparam = BOOL fLeft; (or right)
  1678. #define TBM_GETBUDDY            (WM_USER+33) // wparam = BOOL fLeft; (or right)
  1679. #endif
  1680.  
  1681.  
  1682. #define TB_LINEUP               0
  1683. #define TB_LINEDOWN             1
  1684. #define TB_PAGEUP               2
  1685. #define TB_PAGEDOWN             3
  1686. #define TB_THUMBPOSITION        4
  1687. #define TB_THUMBTRACK           5
  1688. #define TB_TOP                  6
  1689. #define TB_BOTTOM               7
  1690. #define TB_ENDTRACK             8
  1691.  
  1692.  
  1693. #if (_WIN32_IE >= 0x0300)
  1694. // custom draw item specs
  1695. #define TBCD_TICS    0x0001
  1696. #define TBCD_THUMB   0x0002
  1697. #define TBCD_CHANNEL 0x0003
  1698. #endif
  1699.  
  1700. #endif // trackbar
  1701.  
  1702. //====== UPDOWN CONTROL =======================================================
  1703.  
  1704. #ifndef NOUPDOWN
  1705.  
  1706. #ifdef _WIN32
  1707.  
  1708. #define UPDOWN_CLASSA           "msctls_updown32"
  1709. #define UPDOWN_CLASSW           L"msctls_updown32"
  1710.  
  1711. #ifdef UNICODE
  1712. #define  UPDOWN_CLASS           UPDOWN_CLASSW
  1713. #else
  1714. #define  UPDOWN_CLASS           UPDOWN_CLASSA
  1715. #endif
  1716.  
  1717. #else
  1718. #define UPDOWN_CLASS            "msctls_updown"
  1719. #endif
  1720.  
  1721.  
  1722. typedef struct _UDACCEL {
  1723.     UINT nSec;
  1724.     UINT nInc;
  1725. } UDACCEL, FAR *LPUDACCEL;
  1726.  
  1727. #define UD_MAXVAL               0x7fff
  1728. #define UD_MINVAL               (-UD_MAXVAL)
  1729.  
  1730. // begin_r_commctrl
  1731.  
  1732. #define UDS_WRAP                0x0001
  1733. #define UDS_SETBUDDYINT         0x0002
  1734. #define UDS_ALIGNRIGHT          0x0004
  1735. #define UDS_ALIGNLEFT           0x0008
  1736. #define UDS_AUTOBUDDY           0x0010
  1737. #define UDS_ARROWKEYS           0x0020
  1738. #define UDS_HORZ                0x0040
  1739. #define UDS_NOTHOUSANDS         0x0080
  1740. #if (_WIN32_IE >= 0x0300)
  1741. #define UDS_HOTTRACK            0x0100
  1742. #endif
  1743.  
  1744. // end_r_commctrl
  1745.  
  1746. #define UDM_SETRANGE            (WM_USER+101)
  1747. #define UDM_GETRANGE            (WM_USER+102)
  1748. #define UDM_SETPOS              (WM_USER+103)
  1749. #define UDM_GETPOS              (WM_USER+104)
  1750. #define UDM_SETBUDDY            (WM_USER+105)
  1751. #define UDM_GETBUDDY            (WM_USER+106)
  1752. #define UDM_SETACCEL            (WM_USER+107)
  1753. #define UDM_GETACCEL            (WM_USER+108)
  1754. #define UDM_SETBASE             (WM_USER+109)
  1755. #define UDM_GETBASE             (WM_USER+110)
  1756. #if (_WIN32_IE >= 0x0400)
  1757. #define UDM_SETRANGE32          (WM_USER+111)
  1758. #define UDM_GETRANGE32          (WM_USER+112) // wParam & lParam are LPINT
  1759. #endif
  1760.  
  1761. WINCOMMCTRLAPI HWND WINAPI CreateUpDownControl(DWORD dwStyle, int x, int y, int cx, int cy,
  1762.                                 HWND hParent, int nID, HINSTANCE hInst,
  1763.                                 HWND hBuddy,
  1764.                                 int nUpper, int nLower, int nPos);
  1765.  
  1766. #if (_WIN32_IE >= 0x0300)
  1767. #define NM_UPDOWN      NMUPDOWN
  1768. #define LPNM_UPDOWN  LPNMUPDOWN
  1769. #else
  1770. #define NMUPDOWN      NM_UPDOWN
  1771. #define LPNMUPDOWN  LPNM_UPDOWN
  1772. #endif
  1773.  
  1774. typedef struct _NM_UPDOWN
  1775. {
  1776.     NMHDR hdr;
  1777.     int iPos;
  1778.     int iDelta;
  1779. } NMUPDOWN, FAR *LPNMUPDOWN;
  1780.  
  1781. #define UDN_DELTAPOS            (UDN_FIRST - 1)
  1782.  
  1783. #endif  // NOUPDOWN
  1784.  
  1785.  
  1786. //====== PROGRESS CONTROL =====================================================
  1787.  
  1788. #ifndef NOPROGRESS
  1789.  
  1790. #ifdef _WIN32
  1791.  
  1792. #define PROGRESS_CLASSA         "msctls_progress32"
  1793. #define PROGRESS_CLASSW         L"msctls_progress32"
  1794.  
  1795. #ifdef UNICODE
  1796. #define  PROGRESS_CLASS         PROGRESS_CLASSW
  1797. #else
  1798. #define  PROGRESS_CLASS         PROGRESS_CLASSA
  1799. #endif
  1800.  
  1801. #else
  1802. #define PROGRESS_CLASS          "msctls_progress"
  1803. #endif
  1804.  
  1805.  
  1806. #if (_WIN32_IE >= 0x0300)
  1807. #define PBS_SMOOTH              0x01
  1808. #define PBS_VERTICAL            0x04
  1809. #endif
  1810.  
  1811. #define PBM_SETRANGE            (WM_USER+1)
  1812. #define PBM_SETPOS              (WM_USER+2)
  1813. #define PBM_DELTAPOS            (WM_USER+3)
  1814. #define PBM_SETSTEP             (WM_USER+4)
  1815. #define PBM_STEPIT              (WM_USER+5)
  1816. #if (_WIN32_IE >= 0x0300)
  1817. #define PBM_SETRANGE32          (WM_USER+6)  // lParam = high, wParam = low
  1818. typedef struct
  1819. {
  1820.    int iLow;
  1821.    int iHigh;
  1822. } PBRANGE, *PPBRANGE;
  1823. #define PBM_GETRANGE            (WM_USER+7)  // wParam = return (TRUE ? low : high). lParam = PPBRANGE or NULL
  1824. #define PBM_GETPOS              (WM_USER+8)
  1825. #endif      // _WIN32_IE >= 0x0300
  1826.  
  1827. #endif  // NOPROGRESS
  1828.  
  1829. // begin_r_commctrl
  1830.  
  1831. //====== COMMON CONTROL STYLES ================================================
  1832.  
  1833. #define CCS_TOP                 0x00000001L
  1834. #define CCS_NOMOVEY             0x00000002L
  1835. #define CCS_BOTTOM              0x00000003L
  1836. #define CCS_NORESIZE            0x00000004L
  1837. #define CCS_NOPARENTALIGN       0x00000008L
  1838. #define CCS_ADJUSTABLE          0x00000020L
  1839. #define CCS_NODIVIDER           0x00000040L
  1840. #if (_WIN32_IE >= 0x0300)
  1841. #define CCS_VERT                0x00000080L
  1842. #define CCS_LEFT                (CCS_VERT | CCS_TOP)
  1843. #define CCS_RIGHT               (CCS_VERT | CCS_BOTTOM)
  1844. #define CCS_NOMOVEX             (CCS_VERT | CCS_NOMOVEY)
  1845. #endif
  1846.  
  1847. // end_r_commctrl
  1848.  
  1849. //====== LISTVIEW CONTROL =====================================================
  1850.  
  1851. #ifndef NOLISTVIEW
  1852.  
  1853. #ifdef _WIN32
  1854.  
  1855. #define WC_LISTVIEWA            "SysListView32"
  1856. #define WC_LISTVIEWW            L"SysListView32"
  1857.  
  1858. #ifdef UNICODE
  1859. #define WC_LISTVIEW             WC_LISTVIEWW
  1860. #else
  1861. #define WC_LISTVIEW             WC_LISTVIEWA
  1862. #endif
  1863.  
  1864. #else
  1865. #define WC_LISTVIEW             "SysListView"
  1866. #endif
  1867.  
  1868. // begin_r_commctrl
  1869.  
  1870. #define LVS_ICON                0x0000
  1871. #define LVS_REPORT              0x0001
  1872. #define LVS_SMALLICON           0x0002
  1873. #define LVS_LIST                0x0003
  1874. #define LVS_TYPEMASK            0x0003
  1875. #define LVS_SINGLESEL           0x0004
  1876. #define LVS_SHOWSELALWAYS       0x0008
  1877. #define LVS_SORTASCENDING       0x0010
  1878. #define LVS_SORTDESCENDING      0x0020
  1879. #define LVS_SHAREIMAGELISTS     0x0040
  1880. #define LVS_NOLABELWRAP         0x0080
  1881. #define LVS_AUTOARRANGE         0x0100
  1882. #define LVS_EDITLABELS          0x0200
  1883. #if (_WIN32_IE >= 0x0300)
  1884. #define LVS_OWNERDATA           0x1000
  1885. #endif
  1886. #define LVS_NOSCROLL            0x2000
  1887.  
  1888. #define LVS_TYPESTYLEMASK       0xfc00
  1889.  
  1890. #define LVS_ALIGNTOP            0x0000
  1891. #define LVS_ALIGNLEFT           0x0800
  1892. #define LVS_ALIGNMASK           0x0c00
  1893.  
  1894. #define LVS_OWNERDRAWFIXED      0x0400
  1895. #define LVS_NOCOLUMNHEADER      0x4000
  1896. #define LVS_NOSORTHEADER        0x8000
  1897.  
  1898. // end_r_commctrl
  1899.  
  1900. #define LVM_GETBKCOLOR          (LVM_FIRST + 0)
  1901. #define ListView_GetBkColor(hwnd)  \
  1902.     (COLORREF)SNDMSG((hwnd), LVM_GETBKCOLOR, 0, 0L)
  1903.  
  1904. #define LVM_SETBKCOLOR          (LVM_FIRST + 1)
  1905. #define ListView_SetBkColor(hwnd, clrBk) \
  1906.     (BOOL)SNDMSG((hwnd), LVM_SETBKCOLOR, 0, (LPARAM)(COLORREF)(clrBk))
  1907.  
  1908. #define LVM_GETIMAGELIST        (LVM_FIRST + 2)
  1909. #define ListView_GetImageList(hwnd, iImageList) \
  1910.     (HIMAGELIST)SNDMSG((hwnd), LVM_GETIMAGELIST, (WPARAM)(INT)(iImageList), 0L)
  1911.  
  1912. #define LVSIL_NORMAL            0
  1913. #define LVSIL_SMALL             1
  1914. #define LVSIL_STATE             2
  1915. #ifdef UNDER_CE
  1916. #define LVSIL_HEADER            3
  1917. #endif // UNDER_CE
  1918.  
  1919. #define LVM_SETIMAGELIST        (LVM_FIRST + 3)
  1920. #define ListView_SetImageList(hwnd, himl, iImageList) \
  1921.     (HIMAGELIST)(UINT)SNDMSG((hwnd), LVM_SETIMAGELIST, (WPARAM)(iImageList), (LPARAM)(UINT)(HIMAGELIST)(himl))
  1922.  
  1923. #define LVM_GETITEMCOUNT        (LVM_FIRST + 4)
  1924. #define ListView_GetItemCount(hwnd) \
  1925.     (int)SNDMSG((hwnd), LVM_GETITEMCOUNT, 0, 0L)
  1926.  
  1927.  
  1928. #define LVIF_TEXT               0x0001
  1929. #define LVIF_IMAGE              0x0002
  1930. #define LVIF_PARAM              0x0004
  1931. #define LVIF_STATE              0x0008
  1932. #if (_WIN32_IE >= 0x0300)
  1933. #define LVIF_INDENT             0x0010
  1934. #define LVIF_NORECOMPUTE        0x0800
  1935. #endif
  1936.  
  1937. #define LVIS_FOCUSED            0x0001
  1938. #define LVIS_SELECTED           0x0002
  1939. #define LVIS_CUT                0x0004
  1940. #define LVIS_DROPHILITED        0x0008
  1941.  
  1942. #define LVIS_OVERLAYMASK        0x0F00
  1943. #define LVIS_STATEIMAGEMASK     0xF000
  1944.  
  1945. #define INDEXTOSTATEIMAGEMASK(i) ((i) << 12)
  1946.  
  1947. #if (_WIN32_IE >= 0x0300)
  1948. #define I_INDENTCALLBACK        (-1)
  1949. #define LV_ITEMA LVITEMA
  1950. #define LV_ITEMW LVITEMW
  1951. #else
  1952. #define tagLVITEMA    _LV_ITEMA
  1953. #define LVITEMA       LV_ITEMA
  1954. #define tagLVITEMW    _LV_ITEMW
  1955. #define LVITEMW       LV_ITEMW
  1956. #endif
  1957.  
  1958. #define LV_ITEM LVITEM
  1959.  
  1960. typedef struct tagLVITEMA
  1961. {
  1962.     UINT mask;
  1963.     int iItem;
  1964.     int iSubItem;
  1965.     UINT state;
  1966.     UINT stateMask;
  1967.     LPSTR pszText;
  1968.     int cchTextMax;
  1969.     int iImage;
  1970.     LPARAM lParam;
  1971. #if (_WIN32_IE >= 0x0300)
  1972.     int iIndent;
  1973. #endif
  1974. } LVITEMA, FAR* LPLVITEMA;
  1975.  
  1976. typedef struct tagLVITEMW
  1977. {
  1978.     UINT mask;
  1979.     int iItem;
  1980.     int iSubItem;
  1981.     UINT state;
  1982.     UINT stateMask;
  1983.     LPWSTR pszText;
  1984.     int cchTextMax;
  1985.     int iImage;
  1986.     LPARAM lParam;
  1987. #if (_WIN32_IE >= 0x0300)
  1988.     int iIndent;
  1989. #endif
  1990. } LVITEMW, FAR* LPLVITEMW;
  1991.  
  1992.  
  1993. #ifdef UNICODE
  1994. #define LVITEM    LVITEMW
  1995. #define LPLVITEM  LPLVITEMW
  1996. #else
  1997. #define LVITEM    LVITEMA
  1998. #define LPLVITEM  LPLVITEMA
  1999. #endif
  2000.  
  2001.  
  2002. #define LPSTR_TEXTCALLBACKW     ((LPWSTR)-1L)
  2003. #define LPSTR_TEXTCALLBACKA     ((LPSTR)-1L)
  2004. #ifdef UNICODE
  2005. #define LPSTR_TEXTCALLBACK      LPSTR_TEXTCALLBACKW
  2006. #else
  2007. #define LPSTR_TEXTCALLBACK      LPSTR_TEXTCALLBACKA
  2008. #endif
  2009.  
  2010. #define I_IMAGECALLBACK         (-1)
  2011.  
  2012. #define LVM_GETITEMA            (LVM_FIRST + 5)
  2013. #define LVM_GETITEMW            (LVM_FIRST + 75)
  2014. #ifdef UNICODE
  2015. #define LVM_GETITEM             LVM_GETITEMW
  2016. #else
  2017. #define LVM_GETITEM             LVM_GETITEMA
  2018. #endif
  2019.  
  2020. #define ListView_GetItem(hwnd, pitem) \
  2021.     (BOOL)SNDMSG((hwnd), LVM_GETITEM, 0, (LPARAM)(LV_ITEM FAR*)(pitem))
  2022.  
  2023.  
  2024. #define LVM_SETITEMA            (LVM_FIRST + 6)
  2025. #define LVM_SETITEMW            (LVM_FIRST + 76)
  2026. #ifdef UNICODE
  2027. #define LVM_SETITEM             LVM_SETITEMW
  2028. #else
  2029. #define LVM_SETITEM             LVM_SETITEMA
  2030. #endif
  2031.  
  2032. #define ListView_SetItem(hwnd, pitem) \
  2033.     (BOOL)SNDMSG((hwnd), LVM_SETITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  2034.  
  2035.  
  2036. #define LVM_INSERTITEMA         (LVM_FIRST + 7)
  2037. #define LVM_INSERTITEMW         (LVM_FIRST + 77)
  2038. #ifdef UNICODE
  2039. #define LVM_INSERTITEM          LVM_INSERTITEMW
  2040. #else
  2041. #define LVM_INSERTITEM          LVM_INSERTITEMA
  2042. #endif
  2043. #define ListView_InsertItem(hwnd, pitem)   \
  2044.     (int)SNDMSG((hwnd), LVM_INSERTITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  2045.  
  2046.  
  2047. #define LVM_DELETEITEM          (LVM_FIRST + 8)
  2048. #define ListView_DeleteItem(hwnd, i) \
  2049.     (BOOL)SNDMSG((hwnd), LVM_DELETEITEM, (WPARAM)(int)(i), 0L)
  2050.  
  2051.  
  2052. #define LVM_DELETEALLITEMS      (LVM_FIRST + 9)
  2053. #define ListView_DeleteAllItems(hwnd) \
  2054.     (BOOL)SNDMSG((hwnd), LVM_DELETEALLITEMS, 0, 0L)
  2055.  
  2056.  
  2057. #define LVM_GETCALLBACKMASK     (LVM_FIRST + 10)
  2058. #define ListView_GetCallbackMask(hwnd) \
  2059.     (BOOL)SNDMSG((hwnd), LVM_GETCALLBACKMASK, 0, 0)
  2060.  
  2061.  
  2062. #define LVM_SETCALLBACKMASK     (LVM_FIRST + 11)
  2063. #define ListView_SetCallbackMask(hwnd, mask) \
  2064.     (BOOL)SNDMSG((hwnd), LVM_SETCALLBACKMASK, (WPARAM)(UINT)(mask), 0)
  2065.  
  2066.  
  2067. #define LVNI_ALL                0x0000
  2068. #define LVNI_FOCUSED            0x0001
  2069. #define LVNI_SELECTED           0x0002
  2070. #define LVNI_CUT                0x0004
  2071. #define LVNI_DROPHILITED        0x0008
  2072.  
  2073. #define LVNI_ABOVE              0x0100
  2074. #define LVNI_BELOW              0x0200
  2075. #define LVNI_TOLEFT             0x0400
  2076. #define LVNI_TORIGHT            0x0800
  2077.  
  2078.  
  2079. #define LVM_GETNEXTITEM         (LVM_FIRST + 12)
  2080. #define ListView_GetNextItem(hwnd, i, flags) \
  2081.     (int)SNDMSG((hwnd), LVM_GETNEXTITEM, (WPARAM)(int)(i), MAKELPARAM((flags), 0))
  2082.  
  2083.  
  2084. #define LVFI_PARAM              0x0001
  2085. #define LVFI_STRING             0x0002
  2086. #define LVFI_PARTIAL            0x0008
  2087. #define LVFI_WRAP               0x0020
  2088. #define LVFI_NEARESTXY          0x0040
  2089.  
  2090. #if (_WIN32_IE >= 0x0300)
  2091. #define LV_FINDINFOA    LVFINDINFOA
  2092. #define LV_FINDINFOW    LVFINDINFOW
  2093. #else
  2094. #define tagLVFINDINFOA  _LV_FINDINFOA
  2095. #define    LVFINDINFOA   LV_FINDINFOA
  2096. #define tagLVFINDINFOW  _LV_FINDINFOW
  2097. #define    LVFINDINFOW   LV_FINDINFOW
  2098. #endif
  2099.  
  2100. #define LV_FINDINFO  LVFINDINFO
  2101.  
  2102. typedef struct tagLVFINDINFOA
  2103. {
  2104.     UINT flags;
  2105.     LPCSTR psz;
  2106.     LPARAM lParam;
  2107.     POINT pt;
  2108.     UINT vkDirection;
  2109. } LVFINDINFOA, FAR* LPFINDINFOA;
  2110.  
  2111. typedef struct tagLVFINDINFOW
  2112. {
  2113.     UINT flags;
  2114.     LPCWSTR psz;
  2115.     LPARAM lParam;
  2116.     POINT pt;
  2117.     UINT vkDirection;
  2118. } LVFINDINFOW, FAR* LPFINDINFOW;
  2119.  
  2120. #ifdef UNICODE
  2121. #define  LVFINDINFO            LVFINDINFOW
  2122. #else
  2123. #define  LVFINDINFO            LVFINDINFOA
  2124. #endif
  2125.  
  2126. #define LVM_FINDITEMA           (LVM_FIRST + 13)
  2127. #define LVM_FINDITEMW           (LVM_FIRST + 83)
  2128. #ifdef UNICODE
  2129. #define  LVM_FINDITEM           LVM_FINDITEMW
  2130. #else
  2131. #define  LVM_FINDITEM           LVM_FINDITEMA
  2132. #endif
  2133.  
  2134. #define ListView_FindItem(hwnd, iStart, plvfi) \
  2135.     (int)SNDMSG((hwnd), LVM_FINDITEM, (WPARAM)(int)(iStart), (LPARAM)(const LV_FINDINFO FAR*)(plvfi))
  2136.  
  2137. #define LVIR_BOUNDS             0
  2138. #define LVIR_ICON               1
  2139. #define LVIR_LABEL              2
  2140. #define LVIR_SELECTBOUNDS       3
  2141.  
  2142.  
  2143. #define LVM_GETITEMRECT         (LVM_FIRST + 14)
  2144. #define ListView_GetItemRect(hwnd, i, prc, code) \
  2145.      (BOOL)SNDMSG((hwnd), LVM_GETITEMRECT, (WPARAM)(int)(i), \
  2146.            ((prc) ? (((RECT FAR *)(prc))->left = (code),(LPARAM)(RECT FAR*)(prc)) : (LPARAM)(RECT FAR*)NULL))
  2147.  
  2148.  
  2149. #define LVM_SETITEMPOSITION     (LVM_FIRST + 15)
  2150. #define ListView_SetItemPosition(hwndLV, i, x, y) \
  2151.     (BOOL)SNDMSG((hwndLV), LVM_SETITEMPOSITION, (WPARAM)(int)(i), MAKELPARAM((x), (y)))
  2152.  
  2153.  
  2154. #define LVM_GETITEMPOSITION     (LVM_FIRST + 16)
  2155. #define ListView_GetItemPosition(hwndLV, i, ppt) \
  2156.     (BOOL)SNDMSG((hwndLV), LVM_GETITEMPOSITION, (WPARAM)(int)(i), (LPARAM)(POINT FAR*)(ppt))
  2157.  
  2158.  
  2159. #define LVM_GETSTRINGWIDTHA     (LVM_FIRST + 17)
  2160. #define LVM_GETSTRINGWIDTHW     (LVM_FIRST + 87)
  2161. #ifdef UNICODE
  2162. #define  LVM_GETSTRINGWIDTH     LVM_GETSTRINGWIDTHW
  2163. #else
  2164. #define  LVM_GETSTRINGWIDTH     LVM_GETSTRINGWIDTHA
  2165. #endif
  2166.  
  2167. #define ListView_GetStringWidth(hwndLV, psz) \
  2168.     (int)SNDMSG((hwndLV), LVM_GETSTRINGWIDTH, 0, (LPARAM)(LPCTSTR)(psz))
  2169.  
  2170.  
  2171. #define LVHT_NOWHERE            0x0001
  2172. #define LVHT_ONITEMICON         0x0002
  2173. #define LVHT_ONITEMLABEL        0x0004
  2174. #define LVHT_ONITEMSTATEICON    0x0008
  2175. #define LVHT_ONITEM             (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)
  2176.  
  2177. #define LVHT_ABOVE              0x0008
  2178. #define LVHT_BELOW              0x0010
  2179. #define LVHT_TORIGHT            0x0020
  2180. #define LVHT_TOLEFT             0x0040
  2181.  
  2182. #if (_WIN32_IE >= 0x0300)
  2183. #define LV_HITTESTINFO LVHITTESTINFO
  2184. #else
  2185. #define tagLVHITTESTINFO  _LV_HITTESTINFO
  2186. #define    LVHITTESTINFO   LV_HITTESTINFO
  2187. #endif
  2188.  
  2189. typedef struct tagLVHITTESTINFO
  2190. {
  2191.     POINT pt;
  2192.     UINT flags;
  2193.     int iItem;
  2194. #if (_WIN32_IE >= 0x0300)
  2195.     int iSubItem;    // this is was NOT in win95.  valid only for LVM_SUBITEMHITTEST
  2196. #endif
  2197. } LVHITTESTINFO, FAR* LPLVHITTESTINFO;
  2198.  
  2199. #define LVM_HITTEST             (LVM_FIRST + 18)
  2200. #define ListView_HitTest(hwndLV, pinfo) \
  2201.     (int)SNDMSG((hwndLV), LVM_HITTEST, 0, (LPARAM)(LV_HITTESTINFO FAR*)(pinfo))
  2202.  
  2203.  
  2204. #define LVM_ENSUREVISIBLE       (LVM_FIRST + 19)
  2205. #define ListView_EnsureVisible(hwndLV, i, fPartialOK) \
  2206.     (BOOL)SNDMSG((hwndLV), LVM_ENSUREVISIBLE, (WPARAM)(int)(i), MAKELPARAM((fPartialOK), 0))
  2207.  
  2208.  
  2209. #define LVM_SCROLL              (LVM_FIRST + 20)
  2210. #define ListView_Scroll(hwndLV, dx, dy) \
  2211.     (BOOL)SNDMSG((hwndLV), LVM_SCROLL, (WPARAM)(int)dx, (LPARAM)(int)dy)
  2212.  
  2213.  
  2214. #define LVM_REDRAWITEMS         (LVM_FIRST + 21)
  2215. #define ListView_RedrawItems(hwndLV, iFirst, iLast) \
  2216.     (BOOL)SNDMSG((hwndLV), LVM_REDRAWITEMS, (WPARAM)(int)iFirst, (LPARAM)(int)iLast)
  2217.  
  2218.  
  2219. #define LVA_DEFAULT             0x0000
  2220. #define LVA_ALIGNLEFT           0x0001
  2221. #define LVA_ALIGNTOP            0x0002
  2222. #define LVA_SNAPTOGRID          0x0005
  2223.  
  2224.  
  2225. #define LVM_ARRANGE             (LVM_FIRST + 22)
  2226. #define ListView_Arrange(hwndLV, code) \
  2227.     (BOOL)SNDMSG((hwndLV), LVM_ARRANGE, (WPARAM)(UINT)(code), 0L)
  2228.  
  2229.  
  2230. #define LVM_EDITLABELA          (LVM_FIRST + 23)
  2231. #define LVM_EDITLABELW          (LVM_FIRST + 118)
  2232. #ifdef UNICODE
  2233. #define LVM_EDITLABEL           LVM_EDITLABELW
  2234. #else
  2235. #define LVM_EDITLABEL           LVM_EDITLABELA
  2236. #endif
  2237.  
  2238. #define ListView_EditLabel(hwndLV, i) \
  2239.     (HWND)SNDMSG((hwndLV), LVM_EDITLABEL, (WPARAM)(int)(i), 0L)
  2240.  
  2241.  
  2242. #define LVM_GETEDITCONTROL      (LVM_FIRST + 24)
  2243. #define ListView_GetEditControl(hwndLV) \
  2244.     (HWND)SNDMSG((hwndLV), LVM_GETEDITCONTROL, 0, 0L)
  2245.  
  2246.  
  2247. #if (_WIN32_IE >= 0x0300)
  2248. #define LV_COLUMNA      LVCOLUMNA
  2249. #define LV_COLUMNW      LVCOLUMNW
  2250. #else
  2251. #define tagLVCOLUMNA    _LV_COLUMNA
  2252. #define    LVCOLUMNA     LV_COLUMNA
  2253. #define tagLVCOLUMNW    _LV_COLUMNW
  2254. #define    LVCOLUMNW     LV_COLUMNW
  2255. #endif
  2256.  
  2257. #define LV_COLUMN       LVCOLUMN
  2258.  
  2259. typedef struct tagLVCOLUMNA
  2260. {
  2261.     UINT mask;
  2262.     int fmt;
  2263.     int cx;
  2264.     LPSTR pszText;
  2265.     int cchTextMax;
  2266.     int iSubItem;
  2267. #if (_WIN32_IE >= 0x0300)
  2268.     int iImage;
  2269.     int iOrder;
  2270. #endif
  2271. } LVCOLUMNA, FAR* LPLVCOLUMNA;
  2272.  
  2273. typedef struct tagLVCOLUMNW
  2274. {
  2275.     UINT mask;
  2276.     int fmt;
  2277.     int cx;
  2278.     LPWSTR pszText;
  2279.     int cchTextMax;
  2280.     int iSubItem;
  2281. #if (_WIN32_IE >= 0x0300)
  2282.     int iImage;
  2283.     int iOrder;
  2284. #endif
  2285. } LVCOLUMNW, FAR* LPLVCOLUMNW;
  2286.  
  2287. #ifdef UNICODE
  2288. #define  LVCOLUMN               LVCOLUMNW
  2289. #define  LPLVCOLUMN             LPLVCOLUMNW
  2290. #else
  2291. #define  LVCOLUMN               LVCOLUMNA
  2292. #define  LPLVCOLUMN             LPLVCOLUMNA
  2293. #endif
  2294.  
  2295.  
  2296. #define LVCF_FMT                0x0001
  2297. #define LVCF_WIDTH              0x0002
  2298. #define LVCF_TEXT               0x0004
  2299. #define LVCF_SUBITEM            0x0008
  2300. #if (_WIN32_IE >= 0x0300)
  2301. #define LVCF_IMAGE              0x0010
  2302. #define LVCF_ORDER              0x0020
  2303. #endif
  2304.  
  2305. #define LVCFMT_LEFT             0x0000
  2306. #define LVCFMT_RIGHT            0x0001
  2307. #define LVCFMT_CENTER           0x0002
  2308. #define LVCFMT_JUSTIFYMASK      0x0003
  2309. #if (_WIN32_IE >= 0x0300)
  2310. #define LVCFMT_IMAGE            0x0800
  2311. #define LVCFMT_BITMAP_ON_RIGHT  0x1000
  2312. #define LVCFMT_COL_HAS_IMAGES   0x8000
  2313. #endif
  2314.  
  2315. #define LVM_GETCOLUMNA          (LVM_FIRST + 25)
  2316. #define LVM_GETCOLUMNW          (LVM_FIRST + 95)
  2317. #ifdef UNICODE
  2318. #define  LVM_GETCOLUMN          LVM_GETCOLUMNW
  2319. #else
  2320. #define  LVM_GETCOLUMN          LVM_GETCOLUMNA
  2321. #endif
  2322.  
  2323. #define ListView_GetColumn(hwnd, iCol, pcol) \
  2324.     (BOOL)SNDMSG((hwnd), LVM_GETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(LV_COLUMN FAR*)(pcol))
  2325.  
  2326.  
  2327. #define LVM_SETCOLUMNA          (LVM_FIRST + 26)
  2328. #define LVM_SETCOLUMNW          (LVM_FIRST + 96)
  2329. #ifdef UNICODE
  2330. #define  LVM_SETCOLUMN          LVM_SETCOLUMNW
  2331. #else
  2332. #define  LVM_SETCOLUMN          LVM_SETCOLUMNA
  2333. #endif
  2334.  
  2335. #define ListView_SetColumn(hwnd, iCol, pcol) \
  2336.     (BOOL)SNDMSG((hwnd), LVM_SETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  2337.  
  2338.  
  2339. #define LVM_INSERTCOLUMNA       (LVM_FIRST + 27)
  2340. #define LVM_INSERTCOLUMNW       (LVM_FIRST + 97)
  2341. #ifdef UNICODE
  2342. #   define  LVM_INSERTCOLUMN    LVM_INSERTCOLUMNW
  2343. #else
  2344. #   define  LVM_INSERTCOLUMN    LVM_INSERTCOLUMNA
  2345. #endif
  2346.  
  2347. #define ListView_InsertColumn(hwnd, iCol, pcol) \
  2348.     (int)SNDMSG((hwnd), LVM_INSERTCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  2349.  
  2350.  
  2351. #define LVM_DELETECOLUMN        (LVM_FIRST + 28)
  2352. #define ListView_DeleteColumn(hwnd, iCol) \
  2353.     (BOOL)SNDMSG((hwnd), LVM_DELETECOLUMN, (WPARAM)(int)(iCol), 0)
  2354.  
  2355.  
  2356. #define LVM_GETCOLUMNWIDTH      (LVM_FIRST + 29)
  2357. #define ListView_GetColumnWidth(hwnd, iCol) \
  2358.     (int)SNDMSG((hwnd), LVM_GETCOLUMNWIDTH, (WPARAM)(int)(iCol), 0)
  2359.  
  2360.  
  2361. #define LVSCW_AUTOSIZE              -1
  2362. #define LVSCW_AUTOSIZE_USEHEADER    -2
  2363. #define LVM_SETCOLUMNWIDTH          (LVM_FIRST + 30)
  2364.  
  2365. #define ListView_SetColumnWidth(hwnd, iCol, cx) \
  2366.     (BOOL)SNDMSG((hwnd), LVM_SETCOLUMNWIDTH, (WPARAM)(int)(iCol), MAKELPARAM((cx), 0))
  2367.  
  2368. #if (_WIN32_IE >= 0x0300)
  2369. #define LVM_GETHEADER               (LVM_FIRST + 31)
  2370. #define ListView_GetHeader(hwnd)\
  2371.     (HWND)SNDMSG((hwnd), LVM_GETHEADER, 0, 0L)
  2372. #endif
  2373.  
  2374. #define LVM_CREATEDRAGIMAGE     (LVM_FIRST + 33)
  2375. #define ListView_CreateDragImage(hwnd, i, lpptUpLeft) \
  2376.     (HIMAGELIST)SNDMSG((hwnd), LVM_CREATEDRAGIMAGE, (WPARAM)(int)(i), (LPARAM)(LPPOINT)(lpptUpLeft))
  2377.  
  2378.  
  2379. #define LVM_GETVIEWRECT         (LVM_FIRST + 34)
  2380. #define ListView_GetViewRect(hwnd, prc) \
  2381.     (BOOL)SNDMSG((hwnd), LVM_GETVIEWRECT, 0, (LPARAM)(RECT FAR*)(prc))
  2382.  
  2383.  
  2384. #define LVM_GETTEXTCOLOR        (LVM_FIRST + 35)
  2385. #define ListView_GetTextColor(hwnd)  \
  2386.     (COLORREF)SNDMSG((hwnd), LVM_GETTEXTCOLOR, 0, 0L)
  2387.  
  2388.  
  2389. #define LVM_SETTEXTCOLOR        (LVM_FIRST + 36)
  2390. #define ListView_SetTextColor(hwnd, clrText) \
  2391.     (BOOL)SNDMSG((hwnd), LVM_SETTEXTCOLOR, 0, (LPARAM)(COLORREF)(clrText))
  2392.  
  2393.  
  2394. #define LVM_GETTEXTBKCOLOR      (LVM_FIRST + 37)
  2395. #define ListView_GetTextBkColor(hwnd)  \
  2396.     (COLORREF)SNDMSG((hwnd), LVM_GETTEXTBKCOLOR, 0, 0L)
  2397.  
  2398.  
  2399. #define LVM_SETTEXTBKCOLOR      (LVM_FIRST + 38)
  2400. #define ListView_SetTextBkColor(hwnd, clrTextBk) \
  2401.     (BOOL)SNDMSG((hwnd), LVM_SETTEXTBKCOLOR, 0, (LPARAM)(COLORREF)(clrTextBk))
  2402.  
  2403.  
  2404. #define LVM_GETTOPINDEX         (LVM_FIRST + 39)
  2405. #define ListView_GetTopIndex(hwndLV) \
  2406.     (int)SNDMSG((hwndLV), LVM_GETTOPINDEX, 0, 0)
  2407.  
  2408.  
  2409. #define LVM_GETCOUNTPERPAGE     (LVM_FIRST + 40)
  2410. #define ListView_GetCountPerPage(hwndLV) \
  2411.     (int)SNDMSG((hwndLV), LVM_GETCOUNTPERPAGE, 0, 0)
  2412.  
  2413.  
  2414. #define LVM_GETORIGIN           (LVM_FIRST + 41)
  2415. #define ListView_GetOrigin(hwndLV, ppt) \
  2416.     (BOOL)SNDMSG((hwndLV), LVM_GETORIGIN, (WPARAM)0, (LPARAM)(POINT FAR*)(ppt))
  2417.  
  2418.  
  2419. #define LVM_UPDATE              (LVM_FIRST + 42)
  2420. #define ListView_Update(hwndLV, i) \
  2421.     (BOOL)SNDMSG((hwndLV), LVM_UPDATE, (WPARAM)i, 0L)
  2422.  
  2423.  
  2424. #define LVM_SETITEMSTATE        (LVM_FIRST + 43)
  2425. #define ListView_SetItemState(hwndLV, i, data, mask) \
  2426. { LV_ITEM _ms_lvi;\
  2427.   _ms_lvi.stateMask = mask;\
  2428.   _ms_lvi.state = data;\
  2429.   SNDMSG((hwndLV), LVM_SETITEMSTATE, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  2430. }
  2431.  
  2432.  
  2433. #define LVM_GETITEMSTATE        (LVM_FIRST + 44)
  2434. #define ListView_GetItemState(hwndLV, i, mask) \
  2435.    (UINT)SNDMSG((hwndLV), LVM_GETITEMSTATE, (WPARAM)i, (LPARAM)mask)
  2436.  
  2437. #if (_WIN32_IE >= 0x0300)
  2438. #define ListView_GetCheckState(hwndLV, i) \
  2439.    ((((UINT)(SNDMSG((hwndLV), LVM_GETITEMSTATE, (WPARAM)i, LVIS_STATEIMAGEMASK))) >> 12) -1)
  2440. #endif
  2441.  
  2442. #define LVM_GETITEMTEXTA        (LVM_FIRST + 45)
  2443. #define LVM_GETITEMTEXTW        (LVM_FIRST + 115)
  2444.  
  2445. #ifdef UNICODE
  2446. #define  LVM_GETITEMTEXT        LVM_GETITEMTEXTW
  2447. #else
  2448. #define  LVM_GETITEMTEXT        LVM_GETITEMTEXTA
  2449. #endif
  2450.  
  2451. #define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_) \
  2452. { LV_ITEM _ms_lvi;\
  2453.   _ms_lvi.iSubItem = iSubItem_;\
  2454.   _ms_lvi.cchTextMax = cchTextMax_;\
  2455.   _ms_lvi.pszText = pszText_;\
  2456.   SNDMSG((hwndLV), LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  2457. }
  2458.  
  2459.  
  2460. #define LVM_SETITEMTEXTA        (LVM_FIRST + 46)
  2461. #define LVM_SETITEMTEXTW        (LVM_FIRST + 116)
  2462.  
  2463. #ifdef UNICODE
  2464. #define  LVM_SETITEMTEXT        LVM_SETITEMTEXTW
  2465. #else
  2466. #define  LVM_SETITEMTEXT        LVM_SETITEMTEXTA
  2467. #endif
  2468.  
  2469. #define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_) \
  2470. { LV_ITEM _ms_lvi;\
  2471.   _ms_lvi.iSubItem = iSubItem_;\
  2472.   _ms_lvi.pszText = pszText_;\
  2473.   SNDMSG((hwndLV), LVM_SETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&_ms_lvi);\
  2474. }
  2475.  
  2476. #if (_WIN32_IE >= 0x0300)
  2477. // these flags only apply to LVS_OWNERDATA listviews in report or list mode
  2478. #define LVSICF_NOINVALIDATEALL  0x00000001
  2479. #define LVSICF_NOSCROLL         0x00000002
  2480. #endif
  2481.  
  2482. #define LVM_SETITEMCOUNT        (LVM_FIRST + 47)
  2483. #define ListView_SetItemCount(hwndLV, cItems) \
  2484.   SNDMSG((hwndLV), LVM_SETITEMCOUNT, (WPARAM)cItems, 0)
  2485.  
  2486. #if (_WIN32_IE >= 0x0300)
  2487. #define ListView_SetItemCountEx(hwndLV, cItems, dwFlags) \
  2488.   SNDMSG((hwndLV), LVM_SETITEMCOUNT, (WPARAM)cItems, (LPARAM)dwFlags)
  2489. #endif
  2490.  
  2491. typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM);
  2492.  
  2493.  
  2494. #define LVM_SORTITEMS           (LVM_FIRST + 48)
  2495. #define ListView_SortItems(hwndLV, _pfnCompare, _lPrm) \
  2496.   (BOOL)SNDMSG((hwndLV), LVM_SORTITEMS, (WPARAM)(LPARAM)_lPrm, \
  2497.   (LPARAM)(PFNLVCOMPARE)_pfnCompare)
  2498.  
  2499.  
  2500. #define LVM_SETITEMPOSITION32   (LVM_FIRST + 49)
  2501. #define ListView_SetItemPosition32(hwndLV, i, x, y) \
  2502. { POINT ptNewPos = {x,y}; \
  2503.     SNDMSG((hwndLV), LVM_SETITEMPOSITION32, (WPARAM)(int)(i), (LPARAM)&ptNewPos); \
  2504. }
  2505.  
  2506.  
  2507. #define LVM_GETSELECTEDCOUNT    (LVM_FIRST + 50)
  2508. #define ListView_GetSelectedCount(hwndLV) \
  2509.     (UINT)SNDMSG((hwndLV), LVM_GETSELECTEDCOUNT, 0, 0L)
  2510.  
  2511.  
  2512. #define LVM_GETITEMSPACING      (LVM_FIRST + 51)
  2513. #define ListView_GetItemSpacing(hwndLV, fSmall) \
  2514.         (DWORD)SNDMSG((hwndLV), LVM_GETITEMSPACING, fSmall, 0L)
  2515.  
  2516.  
  2517. #define LVM_GETISEARCHSTRINGA   (LVM_FIRST + 52)
  2518. #define LVM_GETISEARCHSTRINGW   (LVM_FIRST + 117)
  2519.  
  2520. #ifdef UNICODE
  2521. #define LVM_GETISEARCHSTRING    LVM_GETISEARCHSTRINGW
  2522. #else
  2523. #define LVM_GETISEARCHSTRING    LVM_GETISEARCHSTRINGA
  2524. #endif
  2525.  
  2526. #define ListView_GetISearchString(hwndLV, lpsz) \
  2527.         (BOOL)SNDMSG((hwndLV), LVM_GETISEARCHSTRING, 0, (LPARAM)(LPTSTR)lpsz)
  2528.  
  2529. #if (_WIN32_IE >= 0x0300)
  2530. #define LVM_SETICONSPACING      (LVM_FIRST + 53)
  2531. // -1 for cx and cy means we'll use the default (system settings)
  2532. // 0 for cx or cy means use the current setting (allows you to change just one param)
  2533. #define ListView_SetIconSpacing(hwndLV, cx, cy) \
  2534.         (DWORD)SNDMSG((hwndLV), LVM_SETICONSPACING, 0, MAKELONG(cx,cy))
  2535.  
  2536.  
  2537. #define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 54)   // optional wParam == mask
  2538. #define ListView_SetExtendedListViewStyle(hwndLV, dw)\
  2539.         (DWORD)SNDMSG((hwndLV), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dw)
  2540. #if (_WIN32_IE >= 0x0400)
  2541. #define ListView_SetExtendedListViewStyleEx(hwndLV, dwMask, dw)\
  2542.         (DWORD)SNDMSG((hwndLV), LVM_SETEXTENDEDLISTVIEWSTYLE, dwMask, dw)
  2543. #endif
  2544.  
  2545. #define LVM_GETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 55)
  2546. #define ListView_GetExtendedListViewStyle(hwndLV)\
  2547.         (DWORD)SNDMSG((hwndLV), LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
  2548.  
  2549. #define LVS_EX_GRIDLINES        0x00000001
  2550. #define LVS_EX_SUBITEMIMAGES    0x00000002
  2551. #define LVS_EX_CHECKBOXES       0x00000004
  2552. #define LVS_EX_TRACKSELECT      0x00000008
  2553. #define LVS_EX_HEADERDRAGDROP   0x00000010
  2554. #define LVS_EX_FULLROWSELECT    0x00000020 // applies to report mode only
  2555.  
  2556. #define LVM_GETSUBITEMRECT      (LVM_FIRST + 56)
  2557. #define ListView_GetSubItemRect(hwnd, iItem, iSubItem, code, prc) \
  2558.         (BOOL)SNDMSG((hwnd), LVM_GETSUBITEMRECT, (WPARAM)(int)(iItem), \
  2559.                 ((prc) ? ((((LPRECT)(prc))->top = iSubItem), (((LPRECT)(prc))->left = code), (LPARAM)(prc)) : (LPARAM)(LPRECT)NULL))
  2560.  
  2561. #define LVM_SUBITEMHITTEST      (LVM_FIRST + 57)
  2562. #define ListView_SubItemHitTest(hwnd, plvhti) \
  2563.         (int)SNDMSG((hwnd), LVM_SUBITEMHITTEST, 0, (LPARAM)(LPLVHITTESTINFO)(plvhti))
  2564.  
  2565. #define LVM_SETCOLUMNORDERARRAY (LVM_FIRST + 58)
  2566. #define ListView_SetColumnOrderArray(hwnd, iCount, pi) \
  2567.         (BOOL)SNDMSG((hwnd), LVM_SETCOLUMNORDERARRAY, (WPARAM)iCount, (LPARAM)(LPINT)pi)
  2568.  
  2569. #define LVM_GETCOLUMNORDERARRAY (LVM_FIRST + 59)
  2570. #define ListView_GetColumnOrderArray(hwnd, iCount, pi) \
  2571.         (BOOL)SNDMSG((hwnd), LVM_GETCOLUMNORDERARRAY, (WPARAM)iCount, (LPARAM)(LPINT)pi)
  2572.  
  2573. #define LVM_APPROXIMATEVIEWRECT (LVM_FIRST + 64)
  2574. #define ListView_ApproximateViewRect(hwnd, iWidth, iHeight, iCount) \
  2575.         (DWORD)SNDMSG((hwnd), LVM_APPROXIMATEVIEWRECT, iCount, MAKELPARAM(iWidth, iHeight))
  2576. #endif      // _WIN32_IE >= 0x0300
  2577.  
  2578. #if (_WIN32_IE >= 0x0400)
  2579. #define LVM_GETSELECTIONMARK    (LVM_FIRST + 66)
  2580. #define ListView_GetSelectionMark(hwnd) \
  2581.     (int)SNDMSG((hwnd), LVM_GETSELECTIONMARK, 0, 0)
  2582.  
  2583. #define LVM_SETSELECTIONMARK    (LVM_FIRST + 67)
  2584. #define ListView_SetSelectionMark(hwnd, i) \
  2585.     (int)SNDMSG((hwnd), LVM_GETSELECTIONMARK, 0, (LPARAM)i)
  2586. #endif      // _WIN32_IE >= 0x0400
  2587.  
  2588. #if (_WIN32_IE >= 0x0300)
  2589. #define LPNM_LISTVIEW   LPNMLISTVIEW
  2590. #define NM_LISTVIEW     NMLISTVIEW
  2591. #else
  2592. #define tagNMLISTVIEW   _NM_LISTVIEW
  2593. #define    NMLISTVIEW    NM_LISTVIEW
  2594. #define  LPNMLISTVIEW  LPNM_LISTVIEW
  2595. #endif
  2596.  
  2597. typedef struct tagNMLISTVIEW
  2598. {
  2599.     NMHDR   hdr;
  2600.     int     iItem;
  2601.     int     iSubItem;
  2602.     UINT    uNewState;
  2603.     UINT    uOldState;
  2604.     UINT    uChanged;
  2605.     POINT   ptAction;
  2606.     LPARAM  lParam;
  2607. } NMLISTVIEW, FAR *LPNMLISTVIEW;
  2608.  
  2609.  
  2610. #if (_WIN32_IE >= 0x0300)
  2611. typedef struct tagNMLVCUSTOMDRAW
  2612. {
  2613.     NMCUSTOMDRAW nmcd;
  2614.     COLORREF clrText;
  2615.     COLORREF clrTextBk;
  2616. #if (_WIN32_IE >= 0x0400)
  2617.     int iSubItem;
  2618. #endif
  2619. } NMLVCUSTOMDRAW, *LPNMLVCUSTOMDRAW;
  2620.  
  2621. typedef struct tagNMLVCACHEHINT
  2622. {
  2623.     NMHDR   hdr;
  2624.     int     iFrom;
  2625.     int     iTo;
  2626. } NMLVCACHEHINT, FAR *LPNMLVCACHEHINT;
  2627.  
  2628. #define LPNM_CACHEHINT  LPNMLVCACHEHINT
  2629. #define PNM_CACHEHINT   LPNMLVCACHEHINT
  2630. #define NM_CACHEHINT    NMLVCACHEHINT
  2631.  
  2632. typedef struct tagNMLVFINDITEM
  2633. {
  2634.     NMHDR   hdr;
  2635.     int     iStart;
  2636.     LVFINDINFO lvfi;
  2637. } NMLVFINDITEM, FAR *LPNMLVFINDITEM;
  2638.  
  2639. #define PNM_FINDITEM    LPNMLVFINDITEM
  2640. #define LPNM_FINDITEM   LPNMLVFINDITEM
  2641. #define NM_FINDITEM     NMLVFINDITEM
  2642.  
  2643. typedef struct tagNMLVODSTATECHANGE
  2644. {
  2645.     NMHDR hdr;
  2646.     int iFrom;
  2647.     int iTo;
  2648.     UINT uNewState;
  2649.     UINT uOldState;
  2650. } NMLVODSTATECHANGE, FAR *LPNMLVODSTATECHANGE;
  2651.  
  2652. #define PNM_ODSTATECHANGE   LPNMLVODSTATECHANGE
  2653. #define LPNM_ODSTATECHANGE  LPNMLVODSTATECHANGE
  2654. #define NM_ODSTATECHANGE    NMLVODSTATECHANGE
  2655. #endif      // _WIN32_IE >= 0x0300
  2656.  
  2657.  
  2658. #define LVN_ITEMCHANGING        (LVN_FIRST-0)
  2659. #define LVN_ITEMCHANGED         (LVN_FIRST-1)
  2660. #define LVN_INSERTITEM          (LVN_FIRST-2)
  2661. #define LVN_DELETEITEM          (LVN_FIRST-3)
  2662. #define LVN_DELETEALLITEMS      (LVN_FIRST-4)
  2663. #define LVN_BEGINLABELEDITA     (LVN_FIRST-5)
  2664. #define LVN_BEGINLABELEDITW     (LVN_FIRST-75)
  2665. #define LVN_ENDLABELEDITA       (LVN_FIRST-6)
  2666. #define LVN_ENDLABELEDITW       (LVN_FIRST-76)
  2667. #define LVN_COLUMNCLICK         (LVN_FIRST-8)
  2668. #define LVN_BEGINDRAG           (LVN_FIRST-9)
  2669. #define LVN_BEGINRDRAG          (LVN_FIRST-11)
  2670.  
  2671. #if (_WIN32_IE >= 0x0300)
  2672. #define LVN_ODCACHEHINT         (LVN_FIRST-13)
  2673. #define LVN_ODFINDITEMA         (LVN_FIRST-52)
  2674. #define LVN_ODFINDITEMW         (LVN_FIRST-79)
  2675.  
  2676. #define LVN_ITEMACTIVATE        (LVN_FIRST-14)
  2677. #define LVN_ODSTATECHANGED      (LVN_FIRST-15)
  2678.  
  2679. #ifdef UNICODE
  2680. #define LVN_ODFINDITEM          LVN_ODFINDITEMW
  2681. #else
  2682. #define LVN_ODFINDITEM          LVN_ODFINDITEMA
  2683. #endif
  2684. #endif      // _WIN32_IE >= 0x0300
  2685.  
  2686. #define LVN_GETDISPINFOA        (LVN_FIRST-50)
  2687. #define LVN_GETDISPINFOW        (LVN_FIRST-77)
  2688. #define LVN_SETDISPINFOA        (LVN_FIRST-51)
  2689. #define LVN_SETDISPINFOW        (LVN_FIRST-78)
  2690.  
  2691. #ifdef UNICODE
  2692. #define LVN_BEGINLABELEDIT      LVN_BEGINLABELEDITW
  2693. #define LVN_ENDLABELEDIT        LVN_ENDLABELEDITW
  2694. #define LVN_GETDISPINFO         LVN_GETDISPINFOW
  2695. #define LVN_SETDISPINFO         LVN_SETDISPINFOW
  2696. #else
  2697. #define LVN_BEGINLABELEDIT      LVN_BEGINLABELEDITA
  2698. #define LVN_ENDLABELEDIT        LVN_ENDLABELEDITA
  2699. #define LVN_GETDISPINFO         LVN_GETDISPINFOA
  2700. #define LVN_SETDISPINFO         LVN_SETDISPINFOA
  2701. #endif
  2702.  
  2703. #ifdef UNDER_CE
  2704. #define LVBD_DRAGSELECT         200
  2705. #endif // UNDER_CE
  2706.  
  2707. #define LVIF_DI_SETITEM         0x1000
  2708.  
  2709. #if (_WIN32_IE >= 0x0300)
  2710. #define LV_DISPINFOA    NMLVDISPINFOA
  2711. #define LV_DISPINFOW    NMLVDISPINFOW
  2712. #else
  2713. #define tagLVDISPINFO   _LV_DISPINFO
  2714. #define NMLVDISPINFOA    LV_DISPINFOA
  2715. #define tagLVDISPINFOW  _LV_DISPINFOW
  2716. #define NMLVDISPINFOW    LV_DISPINFOW
  2717. #endif
  2718.  
  2719. #define LV_DISPINFO     NMLVDISPINFO
  2720.  
  2721. typedef struct tagLVDISPINFO {
  2722.     NMHDR hdr;
  2723.     LVITEMA item;
  2724. } NMLVDISPINFOA, FAR *LPNMLVDISPINFOA;
  2725.  
  2726. typedef struct tagLVDISPINFOW {
  2727.     NMHDR hdr;
  2728.     LVITEMW item;
  2729. } NMLVDISPINFOW, FAR * LPNMLVDISPINFOW;
  2730.  
  2731. #ifdef UNICODE
  2732. #define  NMLVDISPINFO           NMLVDISPINFOW
  2733. #else
  2734. #define  NMLVDISPINFO           NMLVDISPINFOA
  2735. #endif
  2736.  
  2737. #define LVN_KEYDOWN             (LVN_FIRST-55)
  2738.  
  2739. #if (_WIN32_IE >= 0x0300)
  2740. #define LV_KEYDOWN              NMLVKEYDOWN
  2741. #else
  2742. #define tagLVKEYDOWN            _LV_KEYDOWN
  2743. #define NMLVKEYDOWN              LV_KEYDOWN
  2744. #endif
  2745.  
  2746. typedef struct tagLVKEYDOWN
  2747. {
  2748.     NMHDR hdr;
  2749.     WORD wVKey;
  2750.     UINT flags;
  2751. } NMLVKEYDOWN, FAR *LPNMLVKEYDOWN;
  2752.  
  2753. #if (_WIN32_IE >= 0x0300)
  2754. #define LVN_MARQUEEBEGIN        (LVN_FIRST-56)
  2755. #endif
  2756.  
  2757. #endif // NOLISTVIEW
  2758.  
  2759. //====== TREEVIEW CONTROL =====================================================
  2760.  
  2761. #ifndef NOTREEVIEW
  2762.  
  2763. #ifdef _WIN32
  2764. #define WC_TREEVIEWA            "SysTreeView32"
  2765. #define WC_TREEVIEWW            L"SysTreeView32"
  2766.  
  2767. #ifdef UNICODE
  2768. #define  WC_TREEVIEW            WC_TREEVIEWW
  2769. #else
  2770. #define  WC_TREEVIEW            WC_TREEVIEWA
  2771. #endif
  2772.  
  2773. #else
  2774. #define WC_TREEVIEW             "SysTreeView"
  2775. #endif
  2776.  
  2777. // begin_r_commctrl
  2778.  
  2779. #define TVS_HASBUTTONS          0x0001
  2780. #define TVS_HASLINES            0x0002
  2781. #define TVS_LINESATROOT         0x0004
  2782. #define TVS_EDITLABELS          0x0008
  2783. #define TVS_DISABLEDRAGDROP     0x0010
  2784. #define TVS_SHOWSELALWAYS       0x0020
  2785. #if (_WIN32_IE >= 0x0300)
  2786. #define TVS_RTLREADING          0x0040
  2787.  
  2788. #define TVS_NOTOOLTIPS          0x0080
  2789. #define TVS_CHECKBOXES          0x0100
  2790. #define TVS_TRACKSELECT         0x0200
  2791. #if (_WIN32_IE >= 0x0400)
  2792. #define TVS_SINGLEEXPAND        0x0400
  2793. #endif
  2794.  
  2795. #endif
  2796.  
  2797. // end_r_commctrl
  2798.  
  2799. typedef struct _TREEITEM FAR* HTREEITEM;
  2800.  
  2801. #define TVIF_TEXT               0x0001
  2802. #define TVIF_IMAGE              0x0002
  2803. #define TVIF_PARAM              0x0004
  2804. #define TVIF_STATE              0x0008
  2805. #define TVIF_HANDLE             0x0010
  2806. #define TVIF_SELECTEDIMAGE      0x0020
  2807. #define TVIF_CHILDREN           0x0040
  2808.  
  2809. #define TVIS_SELECTED           0x0002
  2810. #define TVIS_CUT                0x0004
  2811. #define TVIS_DROPHILITED        0x0008
  2812. #define TVIS_BOLD               0x0010
  2813. #define TVIS_EXPANDED           0x0020
  2814. #define TVIS_EXPANDEDONCE       0x0040
  2815. #if (_WIN32_IE >= 0x0300)
  2816. #define TVIS_EXPANDPARTIAL      0x0080
  2817. #endif
  2818.  
  2819. #define TVIS_OVERLAYMASK        0x0F00
  2820. #define TVIS_STATEIMAGEMASK     0xF000
  2821. #define TVIS_USERMASK           0xF000
  2822.  
  2823.  
  2824. #define I_CHILDRENCALLBACK  (-1)
  2825.  
  2826. #if (_WIN32_IE >= 0x0300)
  2827. #define LPTV_ITEMW              LPTVITEMW
  2828. #define LPTV_ITEMA              LPTVITEMA
  2829. #define TV_ITEMW                TVITEMW
  2830. #define TV_ITEMA                TVITEMA
  2831. #else
  2832. #define tagTVITEMA             _TV_ITEMA
  2833. #define    TVITEMA              TV_ITEMA
  2834. #define  LPTVITEMA            LPTV_ITEMA
  2835. #define tagTVITEMW             _TV_ITEMW
  2836. #define    TVITEMW              TV_ITEMW
  2837. #define  LPTVITEMW            LPTV_ITEMW
  2838. #endif
  2839.  
  2840. #define LPTV_ITEM               LPTVITEM
  2841. #define TV_ITEM                 TVITEM
  2842.  
  2843. typedef struct tagTVITEMA {
  2844.     UINT      mask;
  2845.     HTREEITEM hItem;
  2846.     UINT      state;
  2847.     UINT      stateMask;
  2848.     LPSTR     pszText;
  2849.     int       cchTextMax;
  2850.     int       iImage;
  2851.     int       iSelectedImage;
  2852.     int       cChildren;
  2853.     LPARAM    lParam;
  2854. } TVITEMA, FAR *LPTVITEMA;
  2855.  
  2856. typedef struct tagTVITEMW {
  2857.     UINT      mask;
  2858.     HTREEITEM hItem;
  2859.     UINT      state;
  2860.     UINT      stateMask;
  2861.     LPWSTR    pszText;
  2862.     int       cchTextMax;
  2863.     int       iImage;
  2864.     int       iSelectedImage;
  2865.     int       cChildren;
  2866.     LPARAM    lParam;
  2867. } TVITEMW, FAR *LPTVITEMW;
  2868.  
  2869. #ifdef UNICODE
  2870. #define  TVITEM                 TVITEMW
  2871. #define  LPTVITEM               LPTVITEMW
  2872. #else
  2873. #define  TVITEM                 TVITEMA
  2874. #define  LPTVITEM               LPTVITEMA
  2875. #endif
  2876.  
  2877.  
  2878. #define TVI_ROOT                ((HTREEITEM)0xFFFF0000)
  2879. #define TVI_FIRST               ((HTREEITEM)0xFFFF0001)
  2880. #define TVI_LAST                ((HTREEITEM)0xFFFF0002)
  2881. #define TVI_SORT                ((HTREEITEM)0xFFFF0003)
  2882.  
  2883. #if (_WIN32_IE >= 0x0300)
  2884. #define LPTV_INSERTSTRUCTA      LPTVINSERTSTRUCTA
  2885. #define LPTV_INSERTSTRUCTW      LPTVINSERTSTRUCTW
  2886. #define TV_INSERTSTRUCTA        TVINSERTSTRUCTA
  2887. #define TV_INSERTSTRUCTW        TVINSERTSTRUCTW
  2888. #else
  2889. #define tagTVINSERTSTRUCTA     _TV_INSERTSTRUCTA
  2890. #define    TVINSERTSTRUCTA      TV_INSERTSTRUCTA
  2891. #define  LPTVINSERTSTRUCTA    LPTV_INSERTSTRUCTA
  2892. #define tagTVINSERTSTRUCTW     _TV_INSERTSTRUCTW
  2893. #define    TVINSERTSTRUCTW      TV_INSERTSTRUCTW
  2894. #define  LPTVINSERTSTRUCTW    LPTV_INSERTSTRUCTW
  2895. #endif
  2896.  
  2897. #define TV_INSERTSTRUCT         TVINSERTSTRUCT
  2898. #define LPTV_INSERTSTRUCT       LPTVINSERTSTRUCT
  2899.  
  2900. typedef struct tagTVINSERTSTRUCTA {
  2901.     HTREEITEM hParent;
  2902.     HTREEITEM hInsertAfter;
  2903.     TV_ITEMA item;
  2904. } TVINSERTSTRUCTA, FAR *LPTVINSERTSTRUCTA;
  2905.  
  2906. typedef struct tagTVINSERTSTRUCTW {
  2907.     HTREEITEM hParent;
  2908.     HTREEITEM hInsertAfter;
  2909.     TV_ITEMW item;
  2910. } TVINSERTSTRUCTW, FAR *LPTVINSERTSTRUCTW;
  2911.  
  2912. #ifdef UNICODE
  2913. #define  TVINSERTSTRUCT         TVINSERTSTRUCTW
  2914. #define  LPTVINSERTSTRUCT       LPTVINSERTSTRUCTW
  2915. #else
  2916. #define  TVINSERTSTRUCT         TVINSERTSTRUCTA
  2917. #define  LPTVINSERTSTRUCT       LPTVINSERTSTRUCTA
  2918. #endif
  2919.  
  2920. #define TVM_INSERTITEMA         (TV_FIRST + 0)
  2921. #define TVM_INSERTITEMW         (TV_FIRST + 50)
  2922. #ifdef UNICODE
  2923. #define  TVM_INSERTITEM         TVM_INSERTITEMW
  2924. #else
  2925. #define  TVM_INSERTITEM         TVM_INSERTITEMA
  2926. #endif
  2927.  
  2928. #define TreeView_InsertItem(hwnd, lpis) \
  2929.     (HTREEITEM)SNDMSG((hwnd), TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT)(lpis))
  2930.  
  2931.  
  2932. #define TVM_DELETEITEM          (TV_FIRST + 1)
  2933. #define TreeView_DeleteItem(hwnd, hitem) \
  2934.     (BOOL)SNDMSG((hwnd), TVM_DELETEITEM, 0, (LPARAM)(HTREEITEM)(hitem))
  2935.  
  2936.  
  2937. #define TreeView_DeleteAllItems(hwnd) \
  2938.     (BOOL)SNDMSG((hwnd), TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT)
  2939.  
  2940.  
  2941. #define TVM_EXPAND              (TV_FIRST + 2)
  2942. #define TreeView_Expand(hwnd, hitem, code) \
  2943.     (BOOL)SNDMSG((hwnd), TVM_EXPAND, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  2944.  
  2945.  
  2946. #define TVE_COLLAPSE            0x0001
  2947. #define TVE_EXPAND              0x0002
  2948. #define TVE_TOGGLE              0x0003
  2949. #if (_WIN32_IE >= 0x0300)
  2950. #define TVE_EXPANDPARTIAL       0x4000
  2951. #endif
  2952. #define TVE_COLLAPSERESET       0x8000
  2953.  
  2954.  
  2955. #define TVM_GETITEMRECT         (TV_FIRST + 4)
  2956. #define TreeView_GetItemRect(hwnd, hitem, prc, code) \
  2957.     (*(HTREEITEM FAR *)prc = (hitem), (BOOL)SNDMSG((hwnd), TVM_GETITEMRECT, (WPARAM)(code), (LPARAM)(RECT FAR*)(prc)))
  2958.  
  2959.  
  2960. #define TVM_GETCOUNT            (TV_FIRST + 5)
  2961. #define TreeView_GetCount(hwnd) \
  2962.     (UINT)SNDMSG((hwnd), TVM_GETCOUNT, 0, 0)
  2963.  
  2964.  
  2965. #define TVM_GETINDENT           (TV_FIRST + 6)
  2966. #define TreeView_GetIndent(hwnd) \
  2967.     (UINT)SNDMSG((hwnd), TVM_GETINDENT, 0, 0)
  2968.  
  2969.  
  2970. #define TVM_SETINDENT           (TV_FIRST + 7)
  2971. #define TreeView_SetIndent(hwnd, indent) \
  2972.     (BOOL)SNDMSG((hwnd), TVM_SETINDENT, (WPARAM)indent, 0)
  2973.  
  2974.  
  2975. #define TVM_GETIMAGELIST        (TV_FIRST + 8)
  2976. #define TreeView_GetImageList(hwnd, iImage) \
  2977.     (HIMAGELIST)SNDMSG((hwnd), TVM_GETIMAGELIST, iImage, 0)
  2978.  
  2979.  
  2980. #define TVSIL_NORMAL            0
  2981. #define TVSIL_STATE             2
  2982.  
  2983.  
  2984. #define TVM_SETIMAGELIST        (TV_FIRST + 9)
  2985. #define TreeView_SetImageList(hwnd, himl, iImage) \
  2986.     (HIMAGELIST)SNDMSG((hwnd), TVM_SETIMAGELIST, iImage, (LPARAM)(UINT)(HIMAGELIST)(himl))
  2987.  
  2988.  
  2989. #define TVM_GETNEXTITEM         (TV_FIRST + 10)
  2990. #define TreeView_GetNextItem(hwnd, hitem, code) \
  2991.     (HTREEITEM)SNDMSG((hwnd), TVM_GETNEXTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  2992.  
  2993.  
  2994. #define TVGN_ROOT               0x0000
  2995. #define TVGN_NEXT               0x0001
  2996. #define TVGN_PREVIOUS           0x0002
  2997. #define TVGN_PARENT             0x0003
  2998. #define TVGN_CHILD              0x0004
  2999. #define TVGN_FIRSTVISIBLE       0x0005
  3000. #define TVGN_NEXTVISIBLE        0x0006
  3001. #define TVGN_PREVIOUSVISIBLE    0x0007
  3002. #define TVGN_DROPHILITE         0x0008
  3003. #define TVGN_CARET              0x0009
  3004.  
  3005. #define TreeView_GetChild(hwnd, hitem)          TreeView_GetNextItem(hwnd, hitem, TVGN_CHILD)
  3006. #define TreeView_GetNextSibling(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_NEXT)
  3007. #define TreeView_GetPrevSibling(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUS)
  3008. #define TreeView_GetParent(hwnd, hitem)         TreeView_GetNextItem(hwnd, hitem, TVGN_PARENT)
  3009. #define TreeView_GetFirstVisible(hwnd)          TreeView_GetNextItem(hwnd, NULL,  TVGN_FIRSTVISIBLE)
  3010. #define TreeView_GetNextVisible(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTVISIBLE)
  3011. #define TreeView_GetPrevVisible(hwnd, hitem)    TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUSVISIBLE)
  3012. #define TreeView_GetSelection(hwnd)             TreeView_GetNextItem(hwnd, NULL,  TVGN_CARET)
  3013. #define TreeView_GetDropHilight(hwnd)           TreeView_GetNextItem(hwnd, NULL,  TVGN_DROPHILITE)
  3014. #define TreeView_GetRoot(hwnd)                  TreeView_GetNextItem(hwnd, NULL,  TVGN_ROOT)
  3015.  
  3016.  
  3017. #define TVM_SELECTITEM          (TV_FIRST + 11)
  3018. #define TreeView_Select(hwnd, hitem, code) \
  3019.     (BOOL)SNDMSG((hwnd), TVM_SELECTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  3020.  
  3021.  
  3022. #define TreeView_SelectItem(hwnd, hitem)            TreeView_Select(hwnd, hitem, TVGN_CARET)
  3023. #define TreeView_SelectDropTarget(hwnd, hitem)      TreeView_Select(hwnd, hitem, TVGN_DROPHILITE)
  3024. #define TreeView_SelectSetFirstVisible(hwnd, hitem) TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBLE)
  3025.  
  3026.  
  3027. #define TVM_GETITEMA            (TV_FIRST + 12)
  3028. #define TVM_GETITEMW            (TV_FIRST + 62)
  3029.  
  3030. #ifdef UNICODE
  3031. #define  TVM_GETITEM            TVM_GETITEMW
  3032. #else
  3033. #define  TVM_GETITEM            TVM_GETITEMA
  3034. #endif
  3035.  
  3036. #define TreeView_GetItem(hwnd, pitem) \
  3037.     (BOOL)SNDMSG((hwnd), TVM_GETITEM, 0, (LPARAM)(TV_ITEM FAR*)(pitem))
  3038.  
  3039.  
  3040. #define TVM_SETITEMA            (TV_FIRST + 13)
  3041. #define TVM_SETITEMW            (TV_FIRST + 63)
  3042.  
  3043. #ifdef UNICODE
  3044. #define  TVM_SETITEM            TVM_SETITEMW
  3045. #else
  3046. #define  TVM_SETITEM            TVM_SETITEMA
  3047. #endif
  3048.  
  3049. #define TreeView_SetItem(hwnd, pitem) \
  3050.     (BOOL)SNDMSG((hwnd), TVM_SETITEM, 0, (LPARAM)(const TV_ITEM FAR*)(pitem))
  3051.  
  3052.  
  3053. #define TVM_EDITLABELA          (TV_FIRST + 14)
  3054. #define TVM_EDITLABELW          (TV_FIRST + 65)
  3055. #ifdef UNICODE
  3056. #define TVM_EDITLABEL           TVM_EDITLABELW
  3057. #else
  3058. #define TVM_EDITLABEL           TVM_EDITLABELA
  3059. #endif
  3060.  
  3061. #define TreeView_EditLabel(hwnd, hitem) \
  3062.     (HWND)SNDMSG((hwnd), TVM_EDITLABEL, 0, (LPARAM)(HTREEITEM)(hitem))
  3063.  
  3064.  
  3065. #define TVM_GETEDITCONTROL      (TV_FIRST + 15)
  3066. #define TreeView_GetEditControl(hwnd) \
  3067.     (HWND)SNDMSG((hwnd), TVM_GETEDITCONTROL, 0, 0)
  3068.  
  3069.  
  3070. #define TVM_GETVISIBLECOUNT     (TV_FIRST + 16)
  3071. #define TreeView_GetVisibleCount(hwnd) \
  3072.     (UINT)SNDMSG((hwnd), TVM_GETVISIBLECOUNT, 0, 0)
  3073.  
  3074.  
  3075. #define TVM_HITTEST             (TV_FIRST + 17)
  3076. #define TreeView_HitTest(hwnd, lpht) \
  3077.     (HTREEITEM)SNDMSG((hwnd), TVM_HITTEST, 0, (LPARAM)(LPTV_HITTESTINFO)(lpht))
  3078.  
  3079.  
  3080. #if (_WIN32_IE >= 0x0300)
  3081. #define LPTV_HITTESTINFO   LPTVHITTESTINFO
  3082. #define   TV_HITTESTINFO     TVHITTESTINFO
  3083. #else
  3084. #define tagTVHITTESTINFO    _TV_HITTESTINFO
  3085. #define    TVHITTESTINFO     TV_HITTESTINFO
  3086. #define  LPTVHITTESTINFO   LPTV_HITTESTINFO
  3087. #endif
  3088.  
  3089. typedef struct tagTVHITTESTINFO {
  3090.     POINT       pt;
  3091.     UINT        flags;
  3092.     HTREEITEM   hItem;
  3093. } TVHITTESTINFO, FAR *LPTVHITTESTINFO;
  3094.  
  3095. #define TVHT_NOWHERE            0x0001
  3096. #define TVHT_ONITEMICON         0x0002
  3097. #define TVHT_ONITEMLABEL        0x0004
  3098. #define TVHT_ONITEM             (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON)
  3099. #define TVHT_ONITEMINDENT       0x0008
  3100. #define TVHT_ONITEMBUTTON       0x0010
  3101. #define TVHT_ONITEMRIGHT        0x0020
  3102. #define TVHT_ONITEMSTATEICON    0x0040
  3103.  
  3104. #define TVHT_ABOVE              0x0100
  3105. #define TVHT_BELOW              0x0200
  3106. #define TVHT_TORIGHT            0x0400
  3107. #define TVHT_TOLEFT             0x0800
  3108.  
  3109.  
  3110. #define TVM_CREATEDRAGIMAGE     (TV_FIRST + 18)
  3111. #define TreeView_CreateDragImage(hwnd, hitem) \
  3112.     (HIMAGELIST)SNDMSG((hwnd), TVM_CREATEDRAGIMAGE, 0, (LPARAM)(HTREEITEM)(hitem))
  3113.  
  3114.  
  3115. #define TVM_SORTCHILDREN        (TV_FIRST + 19)
  3116. #define TreeView_SortChildren(hwnd, hitem, recurse) \
  3117.     (BOOL)SNDMSG((hwnd), TVM_SORTCHILDREN, (WPARAM)recurse, (LPARAM)(HTREEITEM)(hitem))
  3118.  
  3119.  
  3120. #define TVM_ENSUREVISIBLE       (TV_FIRST + 20)
  3121. #define TreeView_EnsureVisible(hwnd, hitem) \
  3122.     (BOOL)SNDMSG((hwnd), TVM_ENSUREVISIBLE, 0, (LPARAM)(HTREEITEM)(hitem))
  3123.  
  3124.  
  3125. #define TVM_SORTCHILDRENCB      (TV_FIRST + 21)
  3126. #define TreeView_SortChildrenCB(hwnd, psort, recurse) \
  3127.     (BOOL)SNDMSG((hwnd), TVM_SORTCHILDRENCB, (WPARAM)recurse, \
  3128.     (LPARAM)(LPTV_SORTCB)(psort))
  3129.  
  3130.  
  3131. #define TVM_ENDEDITLABELNOW     (TV_FIRST + 22)
  3132. #define TreeView_EndEditLabelNow(hwnd, fCancel) \
  3133.     (BOOL)SNDMSG((hwnd), TVM_ENDEDITLABELNOW, (WPARAM)fCancel, 0)
  3134.  
  3135.  
  3136. #define TVM_GETISEARCHSTRINGA   (TV_FIRST + 23)
  3137. #define TVM_GETISEARCHSTRINGW   (TV_FIRST + 64)
  3138.  
  3139. #ifdef UNICODE
  3140. #define TVM_GETISEARCHSTRING     TVM_GETISEARCHSTRINGW
  3141. #else
  3142. #define TVM_GETISEARCHSTRING     TVM_GETISEARCHSTRINGA
  3143. #endif
  3144.  
  3145. #define TreeView_GetISearchString(hwndTV, lpsz) \
  3146.         (BOOL)SNDMSG((hwndTV), TVM_GETISEARCHSTRING, 0, (LPARAM)(LPTSTR)lpsz)
  3147.  
  3148.  
  3149. typedef int (CALLBACK *PFNTVCOMPARE)(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  3150.  
  3151. #if (_WIN32_IE >= 0x0300)
  3152. #define LPTV_SORTCB    LPTVSORTCB
  3153. #define   TV_SORTCB      TVSORTCB
  3154. #else
  3155. #define tagTVSORTCB    _TV_SORTCB
  3156. #define    TVSORTCB     TV_SORTCB
  3157. #define  LPTVSORTCB   LPTV_SORTCB
  3158. #endif
  3159.  
  3160. typedef struct tagTVSORTCB
  3161. {
  3162.         HTREEITEM       hParent;
  3163.         PFNTVCOMPARE    lpfnCompare;
  3164.         LPARAM          lParam;
  3165. } TVSORTCB, FAR *LPTVSORTCB;
  3166.  
  3167.  
  3168. #if (_WIN32_IE >= 0x0300)
  3169. #define LPNM_TREEVIEWA          LPNMTREEVIEWA
  3170. #define LPNM_TREEVIEWW          LPNMTREEVIEWW
  3171. #define NM_TREEVIEWW            NMTREEVIEWW
  3172. #define NM_TREEVIEWA            NMTREEVIEWA
  3173. #else
  3174. #define tagNMTREEVIEWA          _NM_TREEVIEWA
  3175. #define tagNMTREEVIEWW          _NM_TREEVIEWW
  3176. #define NMTREEVIEWA             NM_TREEVIEWA
  3177. #define NMTREEVIEWW             NM_TREEVIEWW
  3178. #define LPNMTREEVIEWA           LPNM_TREEVIEWA
  3179. #define LPNMTREEVIEWW           LPNM_TREEVIEWW
  3180. #endif
  3181.  
  3182. #define LPNM_TREEVIEW           LPNMTREEVIEW
  3183. #define NM_TREEVIEW             NMTREEVIEW
  3184.  
  3185. typedef struct tagNMTREEVIEWA {
  3186.     NMHDR       hdr;
  3187.     UINT        action;
  3188.     TVITEMA    itemOld;
  3189.     TVITEMA    itemNew;
  3190.     POINT       ptDrag;
  3191. } NMTREEVIEWA, FAR *LPNMTREEVIEWA;
  3192.  
  3193.  
  3194. typedef struct tagNMTREEVIEWW {
  3195.     NMHDR       hdr;
  3196.     UINT        action;
  3197.     TVITEMW    itemOld;
  3198.     TVITEMW    itemNew;
  3199.     POINT       ptDrag;
  3200. } NMTREEVIEWW, FAR *LPNMTREEVIEWW;
  3201.  
  3202.  
  3203. #ifdef UNICODE
  3204. #define  NMTREEVIEW             NMTREEVIEWW
  3205. #define  LPNMTREEVIEW           LPNMTREEVIEWW
  3206. #else
  3207. #define  NMTREEVIEW             NMTREEVIEWA
  3208. #define  LPNMTREEVIEW           LPNMTREEVIEWA
  3209. #endif
  3210.  
  3211.  
  3212. #define TVN_SELCHANGINGA        (TVN_FIRST-1)
  3213. #define TVN_SELCHANGINGW        (TVN_FIRST-50)
  3214. #define TVN_SELCHANGEDA         (TVN_FIRST-2)
  3215. #define TVN_SELCHANGEDW         (TVN_FIRST-51)
  3216.  
  3217. #define TVC_UNKNOWN             0x0000
  3218. #define TVC_BYMOUSE             0x0001
  3219. #define TVC_BYKEYBOARD          0x0002
  3220.  
  3221. #define TVN_GETDISPINFOA        (TVN_FIRST-3)
  3222. #define TVN_GETDISPINFOW        (TVN_FIRST-52)
  3223. #define TVN_SETDISPINFOA        (TVN_FIRST-4)
  3224. #define TVN_SETDISPINFOW        (TVN_FIRST-53)
  3225.  
  3226. #define TVIF_DI_SETITEM         0x1000
  3227.  
  3228. #if (_WIN32_IE >= 0x0300)
  3229. #define TV_DISPINFOA            NMTVDISPINFOA
  3230. #define TV_DISPINFOW            NMTVDISPINFOW
  3231. #else
  3232. #define tagTVDISPINFOA  _TV_DISPINFOA
  3233. #define NMTVDISPINFOA    TV_DISPINFOA
  3234. #define tagTVDISPINFOW  _TV_DISPINFOW
  3235. #define NMTVDISPINFOW    TV_DISPINFOW
  3236. #endif
  3237.  
  3238. #define TV_DISPINFO             NMTVDISPINFO
  3239.  
  3240. typedef struct tagTVDISPINFOA {
  3241.     NMHDR hdr;
  3242.     TVITEMA item;
  3243. } NMTVDISPINFOA, FAR *LPNMTVDISPINFOA;
  3244.  
  3245. typedef struct tagTVDISPINFOW {
  3246.     NMHDR hdr;
  3247.     TVITEMW item;
  3248. } NMTVDISPINFOW, FAR *LPNMTVDISPINFOW;
  3249.  
  3250.  
  3251. #ifdef UNICODE
  3252. #define NMTVDISPINFO            NMTVDISPINFOW
  3253. #define LPNMTVDISPINFO          LPNMTVDISPINFOW
  3254. #else
  3255. #define NMTVDISPINFO            NMTVDISPINFOA
  3256. #define LPNMTVDISPINFO          LPNMTVDISPINFOA
  3257. #endif
  3258.  
  3259. #define TVN_ITEMEXPANDINGA      (TVN_FIRST-5)
  3260. #define TVN_ITEMEXPANDINGW      (TVN_FIRST-54)
  3261. #define TVN_ITEMEXPANDEDA       (TVN_FIRST-6)
  3262. #define TVN_ITEMEXPANDEDW       (TVN_FIRST-55)
  3263. #define TVN_BEGINDRAGA          (TVN_FIRST-7)
  3264. #define TVN_BEGINDRAGW          (TVN_FIRST-56)
  3265. #define TVN_BEGINRDRAGA         (TVN_FIRST-8)
  3266. #define TVN_BEGINRDRAGW         (TVN_FIRST-57)
  3267. #define TVN_DELETEITEMA         (TVN_FIRST-9)
  3268. #define TVN_DELETEITEMW         (TVN_FIRST-58)
  3269. #define TVN_BEGINLABELEDITA     (TVN_FIRST-10)
  3270. #define TVN_BEGINLABELEDITW     (TVN_FIRST-59)
  3271. #define TVN_ENDLABELEDITA       (TVN_FIRST-11)
  3272. #define TVN_ENDLABELEDITW       (TVN_FIRST-60)
  3273. #define TVN_KEYDOWN             (TVN_FIRST-12)
  3274.  
  3275. #if (_WIN32_IE >= 0x0300)
  3276. #define TV_KEYDOWN      NMTVKEYDOWN
  3277. #else
  3278. #define tagTVKEYDOWN    _TV_KEYDOWN
  3279. #define  NMTVKEYDOWN     TV_KEYDOWN
  3280. #endif
  3281.  
  3282. typedef struct tagTVKEYDOWN {
  3283.     NMHDR hdr;
  3284.     WORD wVKey;
  3285.     UINT flags;
  3286. } NMTVKEYDOWN, FAR *LPNMTVKEYDOWN;
  3287.  
  3288.  
  3289. #ifdef UNICODE
  3290. #define TVN_SELCHANGING         TVN_SELCHANGINGW
  3291. #define TVN_SELCHANGED          TVN_SELCHANGEDW
  3292. #define TVN_GETDISPINFO         TVN_GETDISPINFOW
  3293. #define TVN_SETDISPINFO         TVN_SETDISPINFOW
  3294. #define TVN_ITEMEXPANDING       TVN_ITEMEXPANDINGW
  3295. #define TVN_ITEMEXPANDED        TVN_ITEMEXPANDEDW
  3296. #define TVN_BEGINDRAG           TVN_BEGINDRAGW
  3297. #define TVN_BEGINRDRAG          TVN_BEGINRDRAGW
  3298. #define TVN_DELETEITEM          TVN_DELETEITEMW
  3299. #define TVN_BEGINLABELEDIT      TVN_BEGINLABELEDITW
  3300. #define TVN_ENDLABELEDIT        TVN_ENDLABELEDITW
  3301. #else
  3302. #define TVN_SELCHANGING         TVN_SELCHANGINGA
  3303. #define TVN_SELCHANGED          TVN_SELCHANGEDA
  3304. #define TVN_GETDISPINFO         TVN_GETDISPINFOA
  3305. #define TVN_SETDISPINFO         TVN_SETDISPINFOA
  3306. #define TVN_ITEMEXPANDING       TVN_ITEMEXPANDINGA
  3307. #define TVN_ITEMEXPANDED        TVN_ITEMEXPANDEDA
  3308. #define TVN_BEGINDRAG           TVN_BEGINDRAGA
  3309. #define TVN_BEGINRDRAG          TVN_BEGINRDRAGA
  3310. #define TVN_DELETEITEM          TVN_DELETEITEMA
  3311. #define TVN_BEGINLABELEDIT      TVN_BEGINLABELEDITA
  3312. #define TVN_ENDLABELEDIT        TVN_ENDLABELEDITA
  3313. #endif
  3314.  
  3315. #if (_WIN32_IE >= 0x0300)
  3316. typedef struct tagNMTVCUSTOMDRAW
  3317. {
  3318.     NMCUSTOMDRAW nmcd;
  3319.     COLORREF     clrText;
  3320.     COLORREF     clrTextBk;
  3321. } NMTVCUSTOMDRAW, *LPNMTVCUSTOMDRAW;
  3322. #endif
  3323.  
  3324. #endif      // NOTREEVIEW
  3325.  
  3326. //====== TAB CONTROL ==========================================================
  3327.  
  3328. #ifndef NOTABCONTROL
  3329.  
  3330. #ifdef _WIN32
  3331.  
  3332. #define WC_TABCONTROLA          "SysTabControl32"
  3333. #define WC_TABCONTROLW          L"SysTabControl32"
  3334.  
  3335. #ifdef UNICODE
  3336. #define  WC_TABCONTROL          WC_TABCONTROLW
  3337. #else
  3338. #define  WC_TABCONTROL          WC_TABCONTROLA
  3339. #endif
  3340.  
  3341. #else
  3342. #define WC_TABCONTROL           "SysTabControl"
  3343. #endif
  3344.  
  3345. // begin_r_commctrl
  3346.  
  3347. #if (_WIN32_IE >= 0x0300)
  3348. #define TCS_SCROLLOPPOSITE      0x0001   // assumes multiline tab
  3349. #define TCS_BOTTOM              0x0002
  3350. #define TCS_RIGHT               0x0002
  3351. #define TCS_MULTISELECT         0x0004  // allow multi-select in button mode
  3352. #endif
  3353. #if (_WIN32_IE >= 0x0400)
  3354. #define TCS_FLATBUTTONS         0x0008
  3355. #endif
  3356. #define TCS_FORCEICONLEFT       0x0010
  3357. #define TCS_FORCELABELLEFT      0x0020
  3358. #if (_WIN32_IE >= 0x0300)
  3359. #define TCS_HOTTRACK            0x0040
  3360. #define TCS_VERTICAL            0x0080
  3361. #endif
  3362. #define TCS_TABS                0x0000
  3363. #define TCS_BUTTONS             0x0100
  3364. #define TCS_SINGLELINE          0x0000
  3365. #define TCS_MULTILINE           0x0200
  3366. #define TCS_RIGHTJUSTIFY        0x0000
  3367. #define TCS_FIXEDWIDTH          0x0400
  3368. #define TCS_RAGGEDRIGHT         0x0800
  3369. #define TCS_FOCUSONBUTTONDOWN   0x1000
  3370. #define TCS_OWNERDRAWFIXED      0x2000
  3371. #define TCS_FOCUSNEVER          0x8000
  3372.  
  3373. #if (_WIN32_IE >= 0x0400)
  3374. // EX styles for CreateWindowEx
  3375. #define TCS_EX_FLATSEPARATORS   0x00000001
  3376. #endif
  3377.  
  3378. // end_r_commctrl
  3379.  
  3380. #define TCM_FIRST               0x1300
  3381.  
  3382.  
  3383.  
  3384.  
  3385.  
  3386. #define TCM_GETIMAGELIST        (TCM_FIRST + 2)
  3387. #define TabCtrl_GetImageList(hwnd) \
  3388.     (HIMAGELIST)SNDMSG((hwnd), TCM_GETIMAGELIST, 0, 0L)
  3389.  
  3390.  
  3391. #define TCM_SETIMAGELIST        (TCM_FIRST + 3)
  3392. #define TabCtrl_SetImageList(hwnd, himl) \
  3393.     (HIMAGELIST)SNDMSG((hwnd), TCM_SETIMAGELIST, 0, (LPARAM)(UINT)(HIMAGELIST)(himl))
  3394.  
  3395.  
  3396. #define TCM_GETITEMCOUNT        (TCM_FIRST + 4)
  3397. #define TabCtrl_GetItemCount(hwnd) \
  3398.     (int)SNDMSG((hwnd), TCM_GETITEMCOUNT, 0, 0L)
  3399.  
  3400.  
  3401. #define TCIF_TEXT               0x0001
  3402. #define TCIF_IMAGE              0x0002
  3403. #define TCIF_RTLREADING         0x0004
  3404. #define TCIF_PARAM              0x0008
  3405. #if (_WIN32_IE >= 0x0300)
  3406. #define TCIF_STATE              0x0010
  3407.  
  3408.  
  3409. #define TCIS_BUTTONPRESSED      0x0001
  3410. #endif
  3411. #if (_WIN32_IE >= 0x0400)
  3412. #define TCIS_HIGHLIGHTED        0x0002
  3413. #endif
  3414.  
  3415. #if (_WIN32_IE >= 0x0300)
  3416. #define TC_ITEMHEADERA         TCITEMHEADERA
  3417. #define TC_ITEMHEADERW         TCITEMHEADERW
  3418. #else
  3419. #define tagTCITEMHEADERA       _TC_ITEMHEADERA
  3420. #define    TCITEMHEADERA        TC_ITEMHEADERA
  3421. #define tagTCITEMHEADERW       _TC_ITEMHEADERW
  3422. #define    TCITEMHEADERW        TC_ITEMHEADERW
  3423. #endif
  3424. #define TC_ITEMHEADER          TCITEMHEADER
  3425.  
  3426. typedef struct tagTCITEMHEADERA
  3427. {
  3428.     UINT mask;
  3429.     UINT lpReserved1;
  3430.     UINT lpReserved2;
  3431.     LPSTR pszText;
  3432.     int cchTextMax;
  3433.     int iImage;
  3434. } TCITEMHEADERA, FAR *LPTCITEMHEADERA;
  3435.  
  3436. typedef struct tagTCITEMHEADERW
  3437. {
  3438.     UINT mask;
  3439.     UINT lpReserved1;
  3440.     UINT lpReserved2;
  3441.     LPWSTR pszText;
  3442.     int cchTextMax;
  3443.     int iImage;
  3444. } TCITEMHEADERW, FAR *LPTCITEMHEADERW;
  3445.  
  3446. #ifdef UNICODE
  3447. #define  TCITEMHEADER          TCITEMHEADERW
  3448. #define  LPTCITEMHEADER        LPTCITEMHEADERW
  3449. #else
  3450. #define  TCITEMHEADER          TCITEMHEADERA
  3451. #define  LPTCITEMHEADER        LPTCITEMHEADERA
  3452. #endif
  3453.  
  3454.  
  3455. #if (_WIN32_IE >= 0x0300)
  3456. #define TC_ITEMA                TCITEMA
  3457. #define TC_ITEMW                TCITEMW
  3458. #else
  3459. #define tagTCITEMA              _TC_ITEMA
  3460. #define    TCITEMA               TC_ITEMA
  3461. #define tagTCITEMW              _TC_ITEMW
  3462. #define    TCITEMW               TC_ITEMW
  3463. #endif
  3464. #define TC_ITEM                 TCITEM
  3465.  
  3466. typedef struct tagTCITEMA
  3467. {
  3468.     UINT mask;
  3469. #if (_WIN32_IE >= 0x0300)
  3470.     DWORD dwState;
  3471.     DWORD dwStateMask;
  3472. #else
  3473.     UINT lpReserved1;
  3474.     UINT lpReserved2;
  3475. #endif
  3476.     LPSTR pszText;
  3477.     int cchTextMax;
  3478.     int iImage;
  3479.  
  3480.     LPARAM lParam;
  3481. } TCITEMA, FAR *LPTCITEMA;
  3482.  
  3483. typedef struct tagTCITEMW
  3484. {
  3485.     UINT mask;
  3486. #if (_WIN32_IE >= 0x0300)
  3487.     DWORD dwState;
  3488.     DWORD dwStateMask;
  3489. #else
  3490.     UINT lpReserved1;
  3491.     UINT lpReserved2;
  3492. #endif
  3493.     LPWSTR pszText;
  3494.     int cchTextMax;
  3495.     int iImage;
  3496.  
  3497.     LPARAM lParam;
  3498. } TCITEMW, FAR *LPTCITEMW;
  3499.  
  3500. #ifdef UNICODE
  3501. #define  TCITEM                 TCITEMW
  3502. #define  LPTCITEM               LPTCITEMW
  3503. #else
  3504. #define  TCITEM                 TCITEMA
  3505. #define  LPTCITEM               LPTCITEMA
  3506. #endif
  3507.  
  3508.  
  3509. #define TCM_GETITEMA            (TCM_FIRST + 5)
  3510. #define TCM_GETITEMW            (TCM_FIRST + 60)
  3511.  
  3512. #ifdef UNICODE
  3513. #define TCM_GETITEM             TCM_GETITEMW
  3514. #else
  3515. #define TCM_GETITEM             TCM_GETITEMA
  3516. #endif
  3517.  
  3518. #define TabCtrl_GetItem(hwnd, iItem, pitem) \
  3519.     (BOOL)SNDMSG((hwnd), TCM_GETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  3520.  
  3521.  
  3522. #define TCM_SETITEMA            (TCM_FIRST + 6)
  3523. #define TCM_SETITEMW            (TCM_FIRST + 61)
  3524.  
  3525. #ifdef UNICODE
  3526. #define TCM_SETITEM             TCM_SETITEMW
  3527. #else
  3528. #define TCM_SETITEM             TCM_SETITEMA
  3529. #endif
  3530.  
  3531. #define TabCtrl_SetItem(hwnd, iItem, pitem) \
  3532.     (BOOL)SNDMSG((hwnd), TCM_SETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  3533.  
  3534.  
  3535. #define TCM_INSERTITEMA         (TCM_FIRST + 7)
  3536. #define TCM_INSERTITEMW         (TCM_FIRST + 62)
  3537.  
  3538. #ifdef UNICODE
  3539. #define TCM_INSERTITEM          TCM_INSERTITEMW
  3540. #else
  3541. #define TCM_INSERTITEM          TCM_INSERTITEMA
  3542. #endif
  3543.  
  3544. #define TabCtrl_InsertItem(hwnd, iItem, pitem)   \
  3545.     (int)SNDMSG((hwnd), TCM_INSERTITEM, (WPARAM)(int)iItem, (LPARAM)(const TC_ITEM FAR*)(pitem))
  3546.  
  3547.  
  3548. #define TCM_DELETEITEM          (TCM_FIRST + 8)
  3549. #define TabCtrl_DeleteItem(hwnd, i) \
  3550.     (BOOL)SNDMSG((hwnd), TCM_DELETEITEM, (WPARAM)(int)(i), 0L)
  3551.  
  3552.  
  3553. #define TCM_DELETEALLITEMS      (TCM_FIRST + 9)
  3554. #define TabCtrl_DeleteAllItems(hwnd) \
  3555.     (BOOL)SNDMSG((hwnd), TCM_DELETEALLITEMS, 0, 0L)
  3556.  
  3557.  
  3558. #define TCM_GETITEMRECT         (TCM_FIRST + 10)
  3559. #define TabCtrl_GetItemRect(hwnd, i, prc) \
  3560.     (BOOL)SNDMSG((hwnd), TCM_GETITEMRECT, (WPARAM)(int)(i), (LPARAM)(RECT FAR*)(prc))
  3561.  
  3562.  
  3563. #define TCM_GETCURSEL           (TCM_FIRST + 11)
  3564. #define TabCtrl_GetCurSel(hwnd) \
  3565.     (int)SNDMSG((hwnd), TCM_GETCURSEL, 0, 0)
  3566.  
  3567.  
  3568. #define TCM_SETCURSEL           (TCM_FIRST + 12)
  3569. #define TabCtrl_SetCurSel(hwnd, i) \
  3570.     (int)SNDMSG((hwnd), TCM_SETCURSEL, (WPARAM)i, 0)
  3571.  
  3572.  
  3573. #define TCHT_NOWHERE            0x0001
  3574. #define TCHT_ONITEMICON         0x0002
  3575. #define TCHT_ONITEMLABEL        0x0004
  3576. #define TCHT_ONITEM             (TCHT_ONITEMICON | TCHT_ONITEMLABEL)
  3577.  
  3578. #if (_WIN32_IE >= 0x0300)
  3579. #define LPTC_HITTESTINFO        LPTCHITTESTINFO
  3580. #define TC_HITTESTINFO          TCHITTESTINFO
  3581. #else
  3582. #define tagTCHITTESTINFO        _TC_HITTESTINFO
  3583. #define    TCHITTESTINFO         TC_HITTESTINFO
  3584. #define  LPTCHITTESTINFO       LPTC_HITTESTINFO
  3585. #endif
  3586.  
  3587. typedef struct tagTCHITTESTINFO
  3588. {
  3589.     POINT pt;
  3590.     UINT flags;
  3591. } TCHITTESTINFO, FAR * LPTCHITTESTINFO;
  3592.  
  3593. #define TCM_HITTEST             (TCM_FIRST + 13)
  3594. #define TabCtrl_HitTest(hwndTC, pinfo) \
  3595.     (int)SNDMSG((hwndTC), TCM_HITTEST, 0, (LPARAM)(TC_HITTESTINFO FAR*)(pinfo))
  3596.  
  3597.  
  3598. #define TCM_SETITEMEXTRA        (TCM_FIRST + 14)
  3599. #define TabCtrl_SetItemExtra(hwndTC, cb) \
  3600.     (BOOL)SNDMSG((hwndTC), TCM_SETITEMEXTRA, (WPARAM)(cb), 0L)
  3601.  
  3602.  
  3603. #define TCM_ADJUSTRECT          (TCM_FIRST + 40)
  3604. #define TabCtrl_AdjustRect(hwnd, bLarger, prc) \
  3605.     (int)SNDMSG(hwnd, TCM_ADJUSTRECT, (WPARAM)(BOOL)bLarger, (LPARAM)(RECT FAR *)prc)
  3606.  
  3607.  
  3608. #define TCM_SETITEMSIZE         (TCM_FIRST + 41)
  3609. #define TabCtrl_SetItemSize(hwnd, x, y) \
  3610.     (DWORD)SNDMSG((hwnd), TCM_SETITEMSIZE, 0, MAKELPARAM(x,y))
  3611.  
  3612.  
  3613. #define TCM_REMOVEIMAGE         (TCM_FIRST + 42)
  3614. #define TabCtrl_RemoveImage(hwnd, i) \
  3615.         (void)SNDMSG((hwnd), TCM_REMOVEIMAGE, i, 0L)
  3616.  
  3617.  
  3618. #define TCM_SETPADDING          (TCM_FIRST + 43)
  3619. #define TabCtrl_SetPadding(hwnd,  cx, cy) \
  3620.         (void)SNDMSG((hwnd), TCM_SETPADDING, 0, MAKELPARAM(cx, cy))
  3621.  
  3622.  
  3623. #define TCM_GETROWCOUNT         (TCM_FIRST + 44)
  3624. #define TabCtrl_GetRowCount(hwnd) \
  3625.         (int)SNDMSG((hwnd), TCM_GETROWCOUNT, 0, 0L)
  3626.  
  3627. #define TCM_GETCURFOCUS         (TCM_FIRST + 47)
  3628. #define TabCtrl_GetCurFocus(hwnd) \
  3629.     (int)SNDMSG((hwnd), TCM_GETCURFOCUS, 0, 0)
  3630.  
  3631. #define TCM_SETCURFOCUS         (TCM_FIRST + 48)
  3632. #define TabCtrl_SetCurFocus(hwnd, i) \
  3633.     SNDMSG((hwnd),TCM_SETCURFOCUS, i, 0)
  3634.  
  3635. #if (_WIN32_IE >= 0x0300)
  3636. #define TCM_SETMINTABWIDTH      (TCM_FIRST + 49)
  3637. #define TabCtrl_SetMinTabWidth(hwnd, x) \
  3638.         (int)SNDMSG((hwnd), TCM_SETMINTABWIDTH, 0, x)
  3639.  
  3640.  
  3641. #define TCM_DESELECTALL         (TCM_FIRST + 50)
  3642. #define TabCtrl_DeselectAll(hwnd, fExcludeFocus)\
  3643.         (void)SNDMSG((hwnd), TCM_DESELECTALL, fExcludeFocus, 0)
  3644. #endif
  3645.  
  3646. #if (_WIN32_IE >= 0x0400)
  3647.  
  3648. #define TCM_HIGHLIGHTITEM       (TCM_FIRST + 51)
  3649. #define TabCtrl_HighlightItem(hwnd, i, fHighlight) \
  3650.     (BOOL)SNDMSG((hwnd), TCM_HIGHLIGHTITEM, (WPARAM)i, (LPARAM)MAKELONG (fHighlight, 0))
  3651.  
  3652. #define TCM_SETEXTENDEDSTYLE    (TCM_FIRST + 52)  // optional wParam == mask
  3653. #define TabCtrl_SetExtendedStyle(hwnd, dw)\
  3654.         (DWORD)SNDMSG((hwnd), TCM_SETEXTENDEDSTYLE, 0, dw)
  3655.  
  3656. #define TCM_GETEXTENDEDSTYLE    (TCM_FIRST + 53)
  3657. #define TabCtrl_GetExtendedStyle(hwnd)\
  3658.         (DWORD)SNDMSG((hwnd), TCM_GETEXTENDEDSTYLE, 0, 0)
  3659.  
  3660. #endif      // _WIN32_IE >= 0x0400
  3661.  
  3662. #define TCN_KEYDOWN             (TCN_FIRST - 0)
  3663.  
  3664. #if (_WIN32_IE >= 0x0300)
  3665. #define TC_KEYDOWN              NMTCKEYDOWN
  3666. #else
  3667. #define tagTCKEYDOWN            _TC_KEYDOWN
  3668. #define  NMTCKEYDOWN             TC_KEYDOWN
  3669. #endif
  3670.  
  3671. typedef struct tagTCKEYDOWN
  3672. {
  3673.     NMHDR hdr;
  3674.     WORD wVKey;
  3675.     UINT flags;
  3676. } NMTCKEYDOWN;
  3677.  
  3678. #define TCN_SELCHANGE           (TCN_FIRST - 1)
  3679. #define TCN_SELCHANGING         (TCN_FIRST - 2)
  3680.  
  3681. #endif      // NOTABCONTROL
  3682.  
  3683. #if (_WIN32_IE >= 0x0300)
  3684. //====== MONTHCAL CONTROL ======================================================
  3685.  
  3686. #ifndef NOMONTHCAL
  3687. #ifdef _WIN32
  3688.  
  3689. #define MONTHCAL_CLASSW          L"SysMonthCal32"
  3690. #define MONTHCAL_CLASSA          "SysMonthCal32"
  3691.  
  3692. #ifdef UNICODE
  3693. #define MONTHCAL_CLASS           MONTHCAL_CLASSW
  3694. #else
  3695. #define MONTHCAL_CLASS           MONTHCAL_CLASSA
  3696. #endif
  3697.  
  3698. // bit-packed array of "bold" info for a month
  3699. // if a bit is on, that day is drawn bold
  3700. typedef DWORD MONTHDAYSTATE, FAR * LPMONTHDAYSTATE;
  3701.  
  3702.  
  3703. #define MCM_FIRST           0x1000
  3704.  
  3705. // BOOL MonthCal_GetCurSel(HWND hmc, LPSYSTEMTIME pst)
  3706. //   returns FALSE if MCS_MULTISELECT
  3707. //   returns TRUE and sets *pst to the currently selected date otherwise
  3708. #define MCM_GETCURSEL       (MCM_FIRST + 1)
  3709. #define MonthCal_GetCurSel(hmc, pst)    (BOOL)SNDMSG(hmc, MCM_GETCURSEL, 0, (LPARAM)(pst))
  3710.  
  3711. // BOOL MonthCal_SetCurSel(HWND hmc, LPSYSTEMTIME pst)
  3712. //   returns FALSE if MCS_MULTISELECT
  3713. //   returns TURE and sets the currently selected date to *pst otherwise
  3714. #define MCM_SETCURSEL       (MCM_FIRST + 2)
  3715. #define MonthCal_SetCurSel(hmc, pst)    (BOOL)SNDMSG(hmc, MCM_SETCURSEL, 0, (LPARAM)(pst))
  3716.  
  3717. // DWORD MonthCal_GetMaxSelCount(HWND hmc)
  3718. //   returns the maximum number of selectable days allowed
  3719. #define MCM_GETMAXSELCOUNT  (MCM_FIRST + 3)
  3720. #define MonthCal_GetMaxSelCount(hmc)    (DWORD)SNDMSG(hmc, MCM_GETMAXSELCOUNT, 0, 0L)
  3721.  
  3722. // BOOL MonthCal_SetMaxSelCount(HWND hmc, UINT n)
  3723. //   sets the max number days that can be selected iff MCS_MULTISELECT
  3724. #define MCM_SETMAXSELCOUNT  (MCM_FIRST + 4)
  3725. #define MonthCal_SetMaxSelCount(hmc, n) (BOOL)SNDMSG(hmc, MCM_SETMAXSELCOUNT, (WPARAM)(n), 0L)
  3726.  
  3727. // BOOL MonthCal_GetSelRange(HWND hmc, LPSYSTEMTIME rgst)
  3728. //   sets rgst[0] to the first day of the selection range
  3729. //   sets rgst[1] to the last day of the selection range
  3730. #define MCM_GETSELRANGE     (MCM_FIRST + 5)
  3731. #define MonthCal_GetSelRange(hmc, rgst) SNDMSG(hmc, MCM_GETSELRANGE, 0, (LPARAM)(rgst))
  3732.  
  3733. // BOOL MonthCal_SetSelRange(HWND hmc, LPSYSTEMTIME rgst)
  3734. //   selects the range of days from rgst[0] to rgst[1]
  3735. #define MCM_SETSELRANGE     (MCM_FIRST + 6)
  3736. #define MonthCal_SetSelRange(hmc, rgst) SNDMSG(hmc, MCM_SETSELRANGE, 0, (LPARAM)(rgst))
  3737.  
  3738. // DWORD MonthCal_GetMonthRange(HWND hmc, DWORD gmr, LPSYSTEMTIME rgst)
  3739. //   if rgst specified, sets rgst[0] to the starting date and
  3740. //      and rgst[1] to the ending date of the the selectable (non-grayed)
  3741. //      days if GMR_VISIBLE or all the displayed days (including grayed)
  3742. //      if GMR_DAYSTATE.
  3743. //   returns the number of months spanned by the above range.
  3744. #define MCM_GETMONTHRANGE   (MCM_FIRST + 7)
  3745. #define MonthCal_GetMonthRange(hmc, gmr, rgst)  (DWORD)SNDMSG(hmc, MCM_GETMONTHRANGE, (WPARAM)(gmr), (LPARAM)(rgst))
  3746.  
  3747. // BOOL MonthCal_SetDayState(HWND hmc, int cbds, DAYSTATE *rgds)
  3748. //   cbds is the count of DAYSTATE items in rgds and it must be equal
  3749. //   to the value returned from MonthCal_GetMonthRange(hmc, GMR_DAYSTATE, NULL)
  3750. //   This sets the DAYSTATE bits for each month (grayed and non-grayed
  3751. //   days) displayed in the calendar. The first bit in a month's DAYSTATE
  3752. //   corresponts to bolding day 1, the second bit affects day 2, etc.
  3753. #define MCM_SETDAYSTATE     (MCM_FIRST + 8)
  3754. #define MonthCal_SetDayState(hmc, cbds, rgds)   SNDMSG(hmc, MCM_SETDAYSTATE, (WPARAM)(cbds), (LPARAM)(rgds))
  3755.  
  3756. // BOOL MonthCal_GetMinReqRect(HWND hmc, LPRECT prc)
  3757. //   sets *prc the minimal size needed to display one month
  3758. //   To display two months, undo the AdjustWindowRect calculation already done to
  3759. //   this rect, double the width, and redo the AdjustWindowRect calculation --
  3760. //   the monthcal control will display two calendars in this window (if you also
  3761. //   double the vertical size, you will get 4 calendars)
  3762. //   NOTE: if you want to gurantee that the "Today" string is not clipped,
  3763. //   get the MCM_GETMAXTODAYWIDTH and use the max of that width and this width
  3764. #define MCM_GETMINREQRECT   (MCM_FIRST + 9)
  3765. #define MonthCal_GetMinReqRect(hmc, prc)        SNDMSG(hmc, MCM_GETMINREQRECT, 0, (LPARAM)(prc))
  3766.  
  3767. // set colors to draw control with -- see MCSC_ bits below
  3768. #define MCM_SETCOLOR            (MCM_FIRST + 10)
  3769. #define MonthCal_SetColor(hmc, iColor, clr) SNDMSG(hmc, MCM_SETCOLOR, iColor, clr)
  3770.  
  3771. #define MCM_GETCOLOR            (MCM_FIRST + 11)
  3772. #define MonthCal_GetColor(hmc, iColor) SNDMSG(hmc, MCM_GETCOLOR, iColor, 0)
  3773.  
  3774. #define MCSC_BACKGROUND   0   // the background color (between months)
  3775. #define MCSC_TEXT         1   // the dates
  3776. #define MCSC_TITLEBK      2   // background of the title
  3777. #define MCSC_TITLETEXT    3
  3778. #define MCSC_MONTHBK      4   // background within the month cal
  3779. #define MCSC_TRAILINGTEXT 5   // the text color of header & trailing days
  3780.  
  3781. // set what day is "today"   send NULL to revert back to real date
  3782. #define MCM_SETTODAY    (MCM_FIRST + 12)
  3783. #define MonthCal_SetToday(hmc, pst)             SNDMSG(hmc, MCM_SETTODAY, 0, (LPARAM)pst)
  3784.  
  3785. // get what day is "today"
  3786. // returns BOOL for success/failure
  3787. #define MCM_GETTODAY    (MCM_FIRST + 13)
  3788. #define MonthCal_GetToday(hmc, pst)             (BOOL)SNDMSG(hmc, MCM_GETTODAY, 0, (LPARAM)pst)
  3789.  
  3790. // determine what pinfo->pt is over
  3791. #define MCM_HITTEST          (MCM_FIRST + 14)
  3792. #define MonthCal_HitTest(hmc, pinfo) \
  3793.         SNDMSG(hmc, MCM_HITTEST, 0, (LPARAM)(PMCHITTESTINFO)pinfo)
  3794.  
  3795. typedef struct {
  3796.         UINT cbSize;
  3797.         POINT pt;
  3798.  
  3799.         UINT uHit;   // out param
  3800.         SYSTEMTIME st;
  3801. } MCHITTESTINFO, *PMCHITTESTINFO;
  3802.  
  3803. #define MCHT_TITLE                      0x00010000
  3804. #define MCHT_CALENDAR                   0x00020000
  3805. #define MCHT_TODAYLINK                  0x00030000
  3806.  
  3807. #define MCHT_NEXT                       0x01000000   // these indicate that hitting
  3808. #define MCHT_PREV                       0x02000000  // here will go to the next/prev month
  3809.  
  3810. #define MCHT_NOWHERE                    0x00000000
  3811.  
  3812. #define MCHT_TITLEBK                    (MCHT_TITLE)
  3813. #define MCHT_TITLEMONTH                 (MCHT_TITLE | 0x0001)
  3814. #define MCHT_TITLEYEAR                  (MCHT_TITLE | 0x0002)
  3815. #define MCHT_TITLEBTNNEXT               (MCHT_TITLE | MCHT_NEXT | 0x0003)
  3816. #define MCHT_TITLEBTNPREV               (MCHT_TITLE | MCHT_PREV | 0x0003)
  3817.  
  3818. #define MCHT_CALENDARBK                 (MCHT_CALENDAR)
  3819. #define MCHT_CALENDARDATE               (MCHT_CALENDAR | 0x0001)
  3820. #define MCHT_CALENDARDATENEXT           (MCHT_CALENDARDATE | MCHT_NEXT)
  3821. #define MCHT_CALENDARDATEPREV           (MCHT_CALENDARDATE | MCHT_PREV)
  3822. #define MCHT_CALENDARDAY                (MCHT_CALENDAR | 0x0002)
  3823. #define MCHT_CALENDARWEEKNUM            (MCHT_CALENDAR | 0x0003)
  3824.  
  3825. // set first day of week to iDay:
  3826. // 0 for Monday, 1 for Tuesday, ..., 6 for Sunday
  3827. // -1 for means use locale info
  3828. #define MCM_SETFIRSTDAYOFWEEK (MCM_FIRST + 15)
  3829. #define MonthCal_SetFirstDayOfWeek(hmc, iDay) \
  3830.         SNDMSG(hmc, MCM_SETFIRSTDAYOFWEEK, 0, iDay)
  3831.  
  3832. // DWORD result...  low word has the day.  high word is bool if this is app set
  3833. // or not (FALSE == using locale info)
  3834. #define MCM_GETFIRSTDAYOFWEEK (MCM_FIRST + 16)
  3835. #define MonthCal_GetFirstDayOfWeek(hmc) \
  3836.         (DWORD)SNDMSG(hmc, MCM_GETFIRSTDAYOFWEEK, 0, 0)
  3837.  
  3838. // DWORD MonthCal_GetRange(HWND hmc, LPSYSTEMTIME rgst)
  3839. //   modifies rgst[0] to be the minimum ALLOWABLE systemtime (or 0 if no minimum)
  3840. //   modifies rgst[1] to be the maximum ALLOWABLE systemtime (or 0 if no maximum)
  3841. //   returns GDTR_MIN|GDTR_MAX if there is a minimum|maximum limit
  3842. #define MCM_GETRANGE (MCM_FIRST + 17)
  3843. #define MonthCal_GetRange(hmc, rgst) \
  3844.         (DWORD)SNDMSG(hmc, MCM_GETRANGE, 0, (LPARAM)(rgst))
  3845.  
  3846. // BOOL MonthCal_SetRange(HWND hmc, DWORD gdtr, LPSYSTEMTIME rgst)
  3847. //   if GDTR_MIN, sets the minimum ALLOWABLE systemtime to rgst[0], otherwise removes minimum
  3848. //   if GDTR_MAX, sets the maximum ALLOWABLE systemtime to rgst[1], otherwise removes maximum
  3849. //   returns TRUE on success, FALSE on error (such as invalid parameters)
  3850. #define MCM_SETRANGE (MCM_FIRST + 18)
  3851. #define MonthCal_SetRange(hmc, gd, rgst) \
  3852.         (BOOL)SNDMSG(hmc, MCM_SETRANGE, (WPARAM)(gd), (LPARAM)(rgst))
  3853.  
  3854. // int MonthCal_GetMonthDelta(HWND hmc)
  3855. //   returns the number of months one click on a next/prev button moves by
  3856. #define MCM_GETMONTHDELTA (MCM_FIRST + 19)
  3857. #define MonthCal_GetMonthDelta(hmc) \
  3858.         (int)SNDMSG(hmc, MCM_GETMONTHDELTA, 0, 0)
  3859.  
  3860. // int MonthCal_SetMonthDelta(HWND hmc, int n)
  3861. //   sets the month delta to n. n==0 reverts to moving by a page of months
  3862. //   returns the previous value of n.
  3863. #define MCM_SETMONTHDELTA (MCM_FIRST + 20)
  3864. #define MonthCal_SetMonthDelta(hmc, n) \
  3865.         (int)SNDMSG(hmc, MCM_SETMONTHDELTA, n, 0)
  3866.  
  3867. // DWORD MonthCal_GetMaxTodayWidth(HWND hmc, LPSIZE psz)
  3868. //   sets *psz to the maximum width/height of the "Today" string displayed
  3869. //   at the bottom of the calendar (as long as MCS_NOTODAY is not specified)
  3870. #define MCM_GETMAXTODAYWIDTH (MCM_FIRST + 21)
  3871. #define MonthCal_GetMaxTodayWidth(hmc) \
  3872.         (DWORD)SNDMSG(hmc, MCM_GETMAXTODAYWIDTH, 0, 0)
  3873.  
  3874. // MCN_SELCHANGE is sent whenever the currently displayed date changes
  3875. // via month change, year change, keyboard navigation, prev/next button
  3876. //
  3877. typedef struct tagNMSELCHANGE
  3878. {
  3879.     NMHDR           nmhdr;  // this must be first, so we don't break WM_NOTIFY
  3880.  
  3881.     SYSTEMTIME      stSelStart;
  3882.     SYSTEMTIME      stSelEnd;
  3883. } NMSELCHANGE, FAR * LPNMSELCHANGE;
  3884.  
  3885. #define MCN_SELCHANGE       (MCN_FIRST + 1)
  3886.  
  3887. // MCN_GETDAYSTATE is sent for MCS_DAYSTATE controls whenever new daystate
  3888. // information is needed (month or year scroll) to draw bolding information.
  3889. // The app must fill in cDayState months worth of information starting from
  3890. // stStart date. The app may fill in the array at prgDayState or change
  3891. // prgDayState to point to a different array out of which the information
  3892. // will be copied. (similar to tooltips)
  3893. //
  3894. typedef struct tagNMDAYSTATE
  3895. {
  3896.     NMHDR           nmhdr;  // this must be first, so we don't break WM_NOTIFY
  3897.  
  3898.     SYSTEMTIME      stStart;
  3899.     int             cDayState;
  3900.  
  3901.     LPMONTHDAYSTATE prgDayState; // points to cDayState MONTHDAYSTATEs
  3902. } NMDAYSTATE, FAR * LPNMDAYSTATE;
  3903.  
  3904. #define MCN_GETDAYSTATE     (MCN_FIRST + 3)
  3905.  
  3906. // MCN_SELECT is sent whenever a selection has occured (via mouse or keyboard)
  3907. //
  3908. typedef NMSELCHANGE NMSELECT, FAR * LPNMSELECT;
  3909.  
  3910.  
  3911. #define MCN_SELECT          (MCN_FIRST + 4)
  3912.  
  3913.  
  3914. #define MCS_DAYSTATE        0x0001
  3915. #define MCS_MULTISELECT     0x0002
  3916. #define MCS_WEEKNUMBERS     0x0004
  3917. #if (_WIN32_IE >= 0x0400)
  3918. #define MCS_NOTODAYCIRCLE   0x0008
  3919. #define MCS_NOTODAY         0x0010
  3920. #else
  3921. #define MCS_NOTODAY         0x0008
  3922. #endif      
  3923.  
  3924.  
  3925. #define GMR_VISIBLE     0       // visible portion of display
  3926. #define GMR_DAYSTATE    1       // above plus the grayed out parts of
  3927.                                 // partially displayed months
  3928.  
  3929.  
  3930. #endif // _WIN32
  3931. #endif // NOMONTHCAL
  3932.  
  3933.  
  3934. //====== DATETIMEPICK CONTROL ==================================================
  3935.  
  3936. #ifndef NODATETIMEPICK
  3937. #ifdef _WIN32
  3938.  
  3939. #define DATETIMEPICK_CLASSW          L"SysDateTimePick32"
  3940. #define DATETIMEPICK_CLASSA          "SysDateTimePick32"
  3941.  
  3942. #ifdef UNICODE
  3943. #define DATETIMEPICK_CLASS           DATETIMEPICK_CLASSW
  3944. #else
  3945. #define DATETIMEPICK_CLASS           DATETIMEPICK_CLASSA
  3946. #endif
  3947.  
  3948. #define DTM_FIRST        0x1000
  3949.  
  3950. // DWORD DateTimePick_GetSystemtime(HWND hdp, LPSYSTEMTIME pst)
  3951. //   returns GDT_NONE if "none" is selected (DTS_SHOWNONE only)
  3952. //   returns GDT_VALID and modifies *pst to be the currently selected value
  3953. #define DTM_GETSYSTEMTIME   (DTM_FIRST + 1)
  3954. #define DateTime_GetSystemtime(hdp, pst)    (DWORD)SNDMSG(hdp, DTM_GETSYSTEMTIME, 0, (LPARAM)(pst))
  3955.  
  3956. // BOOL DateTime_SetSystemtime(HWND hdp, DWORD gd, LPSYSTEMTIME pst)
  3957. //   if gd==GDT_NONE, sets datetimepick to None (DTS_SHOWNONE only)
  3958. //   if gd==GDT_VALID, sets datetimepick to *pst
  3959. //   returns TRUE on success, FALSE on error (such as bad params)
  3960. #define DTM_SETSYSTEMTIME   (DTM_FIRST + 2)
  3961. #define DateTime_SetSystemtime(hdp, gd, pst)    (BOOL)SNDMSG(hdp, DTM_SETSYSTEMTIME, (LPARAM)(gd), (LPARAM)(pst))
  3962.  
  3963. // DWORD DateTime_GetRange(HWND hdp, LPSYSTEMTIME rgst)
  3964. //   modifies rgst[0] to be the minimum ALLOWABLE systemtime (or 0 if no minimum)
  3965. //   modifies rgst[1] to be the maximum ALLOWABLE systemtime (or 0 if no maximum)
  3966. //   returns GDTR_MIN|GDTR_MAX if there is a minimum|maximum limit
  3967. #define DTM_GETRANGE (DTM_FIRST + 3)
  3968. #define DateTime_GetRange(hdp, rgst)  (DWORD)SNDMSG(hdp, DTM_GETRANGE, 0, (LPARAM)(rgst))
  3969.  
  3970. // BOOL DateTime_SetRange(HWND hdp, DWORD gdtr, LPSYSTEMTIME rgst)
  3971. //   if GDTR_MIN, sets the minimum ALLOWABLE systemtime to rgst[0], otherwise removes minimum
  3972. //   if GDTR_MAX, sets the maximum ALLOWABLE systemtime to rgst[1], otherwise removes maximum
  3973. //   returns TRUE on success, FALSE on error (such as invalid parameters)
  3974. #define DTM_SETRANGE (DTM_FIRST + 4)
  3975. #define DateTime_SetRange(hdp, gd, rgst)  (BOOL)SNDMSG(hdp, DTM_SETRANGE, (WPARAM)(gd), (LPARAM)(rgst))
  3976.  
  3977. // BOOL DateTime_SetFormat(HWND hdp, LPCTSTR sz)
  3978. //   sets the display formatting string to sz (see GetDateFormat and GetTimeFormat for valid formatting chars)
  3979. //   NOTE: 'X' is a valid formatting character which indicates that the application
  3980. //   will determine how to display information. Such apps must support DTN_WMKEYDOWN,
  3981. //   DTN_FORMAT, and DTN_FORMATQUERY.
  3982. #define DTM_SETFORMATA (DTM_FIRST + 5)
  3983. #define DTM_SETFORMATW (DTM_FIRST + 50)
  3984.  
  3985. #ifdef UNICODE
  3986. #define DTM_SETFORMAT       DTM_SETFORMATW
  3987. #else
  3988. #define DTM_SETFORMAT       DTM_SETFORMATA
  3989. #endif
  3990.  
  3991. #define DateTime_SetFormat(hdp, sz)  (BOOL)SNDMSG(hdp, DTM_SETFORMAT, 0, (LPARAM)(sz))
  3992.  
  3993.  
  3994. #define DTM_SETMCCOLOR    (DTM_FIRST + 6)
  3995. #define DateTime_SetMonthCalColor(hdp, iColor, clr) SNDMSG(hdp, DTM_SETMCCOLOR, iColor, clr)
  3996.  
  3997. #define DTM_GETMCCOLOR    (DTM_FIRST + 7)
  3998. #define DateTime_GetMonthCalColor(hdp, iColor) SNDMSG(hdp, DTM_GETMCCOLOR, iColor, 0)
  3999.  
  4000. // HWND DateTime_GetMonthCal(HWND hdp)
  4001. //   returns the HWND of the MonthCal popup window. Only valid
  4002. // between DTN_DROPDOWN and DTN_CLOSEUP notifications.
  4003. #define DTM_GETMONTHCAL   (DTM_FIRST + 8)
  4004. #define DateTime_GetMonthCal(hdp) (HWND)SNDMSG(hdp, DTM_GETMONTHCAL, 0, 0)
  4005.  
  4006. #if (_WIN32_IE >= 0x0400)
  4007.  
  4008. #define DTM_SETMCFONT     (DTM_FIRST + 9)
  4009. #define DateTime_SetMonthCalFont(hdp, hfont, fRedraw) SNDMSG(hdp, DTM_SETMCFONT, (WPARAM)hfont, (LPARAM)fRedraw)
  4010.  
  4011. #define DTM_GETMCFONT     (DTM_FIRST + 10)
  4012. #define DateTime_GetMonthCalFont(hdp) SNDMSG(hdp, DTM_GETMCFONT, 0, 0)
  4013.  
  4014. #endif      // _WIN32_IE >= 0x0400
  4015.  
  4016. #define DTS_UPDOWN          0x0001 // use UPDOWN instead of MONTHCAL
  4017. #define DTS_SHOWNONE        0x0002 // allow a NONE selection
  4018. #define DTS_SHORTDATEFORMAT 0x0000 // use the short date format (app must forward WM_WININICHANGE messages)
  4019. #define DTS_LONGDATEFORMAT  0x0004 // use the long date format (app must forward WM_WININICHANGE messages)
  4020. #define DTS_TIMEFORMAT      0x0009 // use the time format (app must forward WM_WININICHANGE messages)
  4021. #define DTS_APPCANPARSE     0x0010 // allow user entered strings (app MUST respond to DTN_USERSTRING)
  4022. #define DTS_RIGHTALIGN      0x0020 // right-align popup instead of left-align it
  4023.  
  4024. #define DTN_DATETIMECHANGE  (DTN_FIRST + 1) // the systemtime has changed
  4025. typedef struct tagNMDATETIMECHANGE
  4026. {
  4027.     NMHDR       nmhdr;
  4028.     DWORD       dwFlags;    // GDT_VALID or GDT_NONE
  4029.     SYSTEMTIME  st;         // valid iff dwFlags==GDT_VALID
  4030. } NMDATETIMECHANGE, FAR * LPNMDATETIMECHANGE;
  4031.  
  4032. #define DTN_USERSTRINGA  (DTN_FIRST + 2) // the user has entered a string
  4033. #define DTN_USERSTRINGW  (DTN_FIRST + 15)
  4034. typedef struct tagNMDATETIMESTRINGA
  4035. {
  4036.     NMHDR      nmhdr;
  4037.     LPCSTR     pszUserString;  // string user entered
  4038.     SYSTEMTIME st;             // app fills this in
  4039.     DWORD      dwFlags;        // GDT_VALID or GDT_NONE
  4040. } NMDATETIMESTRINGA, FAR * LPNMDATETIMESTRINGA;
  4041.  
  4042. typedef struct tagNMDATETIMESTRINGW
  4043. {
  4044.     NMHDR      nmhdr;
  4045.     LPCWSTR    pszUserString;  // string user entered
  4046.     SYSTEMTIME st;             // app fills this in
  4047.     DWORD      dwFlags;        // GDT_VALID or GDT_NONE
  4048. } NMDATETIMESTRINGW, FAR * LPNMDATETIMESTRINGW;
  4049.  
  4050. #ifdef UNICODE
  4051. #define DTN_USERSTRING          DTN_USERSTRINGW
  4052. #define NMDATETIMESTRING        NMDATETIMESTRINGW
  4053. #define LPNMDATETIMESTRING      LPNMDATETIMESTRINGW
  4054. #else
  4055. #define DTN_USERSTRING          DTN_USERSTRINGA
  4056. #define NMDATETIMESTRING        NMDATETIMESTRINGA
  4057. #define LPNMDATETIMESTRING      LPNMDATETIMESTRINGA
  4058. #endif
  4059.  
  4060.  
  4061. #define DTN_WMKEYDOWNA  (DTN_FIRST + 3) // modify keydown on app format field (X)
  4062. #define DTN_WMKEYDOWNW  (DTN_FIRST + 16)
  4063. typedef struct tagNMDATETIMEWMKEYDOWNA
  4064. {
  4065.     NMHDR      nmhdr;
  4066.     int        nVirtKey;  // virtual key code of WM_KEYDOWN which MODIFIES an X field
  4067.     LPCSTR     pszFormat; // format substring
  4068.     SYSTEMTIME st;        // current systemtime, app should modify based on key
  4069. } NMDATETIMEWMKEYDOWNA, FAR * LPNMDATETIMEWMKEYDOWNA;
  4070.  
  4071. typedef struct tagNMDATETIMEWMKEYDOWNW
  4072. {
  4073.     NMHDR      nmhdr;
  4074.     int        nVirtKey;  // virtual key code of WM_KEYDOWN which MODIFIES an X field
  4075.     LPCWSTR    pszFormat; // format substring
  4076.     SYSTEMTIME st;        // current systemtime, app should modify based on key
  4077. } NMDATETIMEWMKEYDOWNW, FAR * LPNMDATETIMEWMKEYDOWNW;
  4078.  
  4079. #ifdef UNICODE
  4080. #define DTN_WMKEYDOWN           DTN_WMKEYDOWNW
  4081. #define NMDATETIMEWMKEYDOWN     NMDATETIMEWMKEYDOWNW
  4082. #define LPNMDATETIMEWMKEYDOWN   LPNMDATETIMEWMKEYDOWNW
  4083. #else
  4084. #define DTN_WMKEYDOWN           DTN_WMKEYDOWNA
  4085. #define NMDATETIMEWMKEYDOWN     NMDATETIMEWMKEYDOWNA
  4086. #define LPNMDATETIMEWMKEYDOWN   LPNMDATETIMEWMKEYDOWNA
  4087. #endif
  4088.  
  4089.  
  4090. #define DTN_FORMATA  (DTN_FIRST + 4) // query display for app format field (X)
  4091. #define DTN_FORMATW  (DTN_FIRST + 17)
  4092. typedef struct tagNMDATETIMEFORMATA
  4093. {
  4094.     NMHDR nmhdr;
  4095.     LPCSTR  pszFormat;   // format substring
  4096.     SYSTEMTIME st;       // current systemtime
  4097.     LPCSTR pszDisplay;   // string to display
  4098.     CHAR szDisplay[64];  // buffer pszDisplay originally points at
  4099. } NMDATETIMEFORMATA, FAR * LPNMDATETIMEFORMATA;
  4100.  
  4101. typedef struct tagNMDATETIMEFORMATW
  4102. {
  4103.     NMHDR nmhdr;
  4104.     LPCWSTR pszFormat;   // format substring
  4105.     SYSTEMTIME st;       // current systemtime
  4106.     LPCWSTR pszDisplay;  // string to display
  4107.     WCHAR szDisplay[64]; // buffer pszDisplay originally points at
  4108. } NMDATETIMEFORMATW, FAR * LPNMDATETIMEFORMATW;
  4109.  
  4110. #ifdef UNICODE
  4111. #define DTN_FORMAT             DTN_FORMATW
  4112. #define NMDATETIMEFORMAT        NMDATETIMEFORMATW
  4113. #define LPNMDATETIMEFORMAT      LPNMDATETIMEFORMATW
  4114. #else
  4115. #define DTN_FORMAT             DTN_FORMATA
  4116. #define NMDATETIMEFORMAT        NMDATETIMEFORMATA
  4117. #define LPNMDATETIMEFORMAT      LPNMDATETIMEFORMATA
  4118. #endif
  4119.  
  4120.  
  4121. #define DTN_FORMATQUERYA  (DTN_FIRST + 5) // query formatting info for app format field (X)
  4122. #define DTN_FORMATQUERYW (DTN_FIRST + 18)
  4123. typedef struct tagNMDATETIMEFORMATQUERYA
  4124. {
  4125.     NMHDR nmhdr;
  4126.     LPCSTR pszFormat;  // format substring
  4127.     SIZE szMax;        // max bounding rectangle app will use for this format string
  4128. } NMDATETIMEFORMATQUERYA, FAR * LPNMDATETIMEFORMATQUERYA;
  4129.  
  4130. typedef struct tagNMDATETIMEFORMATQUERYW
  4131. {
  4132.     NMHDR nmhdr;
  4133.     LPCWSTR pszFormat; // format substring
  4134.     SIZE szMax;        // max bounding rectangle app will use for this format string
  4135. } NMDATETIMEFORMATQUERYW, FAR * LPNMDATETIMEFORMATQUERYW;
  4136.  
  4137. #ifdef UNICODE
  4138. #define DTN_FORMATQUERY         DTN_FORMATQUERYW
  4139. #define NMDATETIMEFORMATQUERY   NMDATETIMEFORMATQUERYW
  4140. #define LPNMDATETIMEFORMATQUERY LPNMDATETIMEFORMATQUERYW
  4141. #else
  4142. #define DTN_FORMATQUERY         DTN_FORMATQUERYA
  4143. #define NMDATETIMEFORMATQUERY   NMDATETIMEFORMATQUERYA
  4144. #define LPNMDATETIMEFORMATQUERY LPNMDATETIMEFORMATQUERYA
  4145. #endif
  4146.  
  4147.  
  4148. #define DTN_DROPDOWN    (DTN_FIRST + 6) // MonthCal has dropped down
  4149. #define DTN_CLOSEUP     (DTN_FIRST + 7) // MonthCal is popping up
  4150.  
  4151.  
  4152. #define GDTR_MIN     0x0001
  4153. #define GDTR_MAX     0x0002
  4154.  
  4155. #define GDT_ERROR    -1
  4156. #define GDT_VALID    0
  4157. #define GDT_NONE     1
  4158.  
  4159.  
  4160. // Gryphon special controls (all-caps edit control, tool-tip static & button)
  4161. #define WC_CAPEDIT    L"CAPEDIT"
  4162. #define WC_TSTATIC    L"TTSTATIC"
  4163. #define WC_TBUTTON    L"TTBUTTON"
  4164.  
  4165. #define CEM_UPCASEALLWORDS    (WM_USER + 1)
  4166.  
  4167.  
  4168. #endif // _WIN32
  4169. #endif // NODATETIMEPICK
  4170. #endif      // _WIN32_IE >= 0x0300
  4171.  
  4172. #ifdef __cplusplus
  4173. }
  4174. #endif
  4175.  
  4176. #ifndef UNDER_CE
  4177. #ifdef _WIN32
  4178. #include <poppack.h>
  4179. #endif
  4180. #endif // !UNDER_CE
  4181.  
  4182. #endif
  4183.  
  4184. #ifdef WINCEOEM // UNDER_CE
  4185. #include <pcommctr.h>
  4186. #ifndef UNDER_NT
  4187. #ifdef WINCEMACRO
  4188. #include <mcommctr.h>
  4189. #endif
  4190. #endif // !UNDER_NT
  4191. #endif
  4192.  
  4193. #endif  // _INC_COMMCTRL
  4194.